Permalink
Browse files

Fix for the segfault with WMS TIME patterns (#3795)

  • Loading branch information...
1 parent ca33352 commit a2aed6a54392e15beb72cf8aa2de399d1d52cf9e @szekerest szekerest committed Feb 22, 2013
Showing with 6 additions and 4 deletions.
  1. +4 −4 maplayer.c
  2. +2 −0 maptime.c
View
@@ -893,7 +893,7 @@ makeTimeFilter(layerObj *lp,
if (&lp->filter) {
/* if the filter is set and it's a sting type, concatenate it with
the time. If not just free it */
- if (lp->filter.type == MS_STRING) {
+ if (lp->filter.string && lp->filter.type == MS_STRING) {
pszBuffer = msStringConcatenate(pszBuffer, "((");
pszBuffer = msStringConcatenate(pszBuffer, lp->filter.string);
pszBuffer = msStringConcatenate(pszBuffer, ") and ");
@@ -930,7 +930,7 @@ makeTimeFilter(layerObj *lp,
pszBuffer = msStringConcatenate(pszBuffer, ")");
/* if there was a filter, It was concatenate with an And ans should be closed*/
- if(&lp->filter && lp->filter.type == MS_STRING) {
+ if(&lp->filter && lp->filter.string && lp->filter.type == MS_STRING) {
pszBuffer = msStringConcatenate(pszBuffer, ")");
}
@@ -947,7 +947,7 @@ makeTimeFilter(layerObj *lp,
return MS_FALSE;
if (numtimes >= 1) {
- if (&lp->filter && lp->filter.type == MS_STRING) {
+ if (&lp->filter && lp->filter.string && lp->filter.type == MS_STRING) {
pszBuffer = msStringConcatenate(pszBuffer, "((");
pszBuffer = msStringConcatenate(pszBuffer, lp->filter.string);
pszBuffer = msStringConcatenate(pszBuffer, ") and ");
@@ -1070,7 +1070,7 @@ makeTimeFilter(layerObj *lp,
/* load the string to the filter */
if (pszBuffer && strlen(pszBuffer) > 0) {
- if(&lp->filter && lp->filter.type == MS_STRING)
+ if(&lp->filter && lp->filter.string && lp->filter.type == MS_STRING)
pszBuffer = msStringConcatenate(pszBuffer, ")");
/*
if(lp->filteritem)
View
@@ -97,9 +97,11 @@ void msTimeCleanup() {
if(ms_timeFormats[i].regex) {
ms_regfree(ms_timeFormats[i].regex);
msFree(ms_timeFormats[i].regex);
+ ms_timeFormats[i].regex = NULL;
}
}
msFree(ms_limited_pattern);
+ ms_time_inited = 0;
}
}

0 comments on commit a2aed6a

Please sign in to comment.