Skip to content

Commit

Permalink
mapwfs.c: correctly pair CPL allocation routines with CPL free routines
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Apr 11, 2013
1 parent 092c6d7 commit c0f8907
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mapwfs.c
Expand Up @@ -34,6 +34,7 @@


/* There is a dependency to GDAL/OGR for the GML driver and MiniXML parser */ /* There is a dependency to GDAL/OGR for the GML driver and MiniXML parser */
#include "cpl_minixml.h" #include "cpl_minixml.h"
#include "cpl_conv.h"


#include "mapogcfilter.h" #include "mapogcfilter.h"
#include "mapowscommon.h" #include "mapowscommon.h"
Expand Down Expand Up @@ -3245,14 +3246,17 @@ int msWFSParseRequest(mapObj *map, cgiRequestObj *request, owsRequestObj *ows_re
psFilter = CPLGetXMLNode(psQuery, "Filter"); psFilter = CPLGetXMLNode(psQuery, "Filter");


if (psFilter) { if (psFilter) {
if (!bMultiLayer) if (!bMultiLayer) {
wfsparams->pszFilter = CPLSerializeXMLTree(psFilter); char* pszCPLTmp = CPLSerializeXMLTree(psFilter);
wfsparams->pszFilter = msStrdup(pszCPLTmp);
CPLFree(pszCPLTmp);
}
else { else {
pszSerializedFilter = CPLSerializeXMLTree(psFilter); pszSerializedFilter = CPLSerializeXMLTree(psFilter);
pszTmp = (char *)msSmallMalloc(sizeof(char)* pszTmp = (char *)msSmallMalloc(sizeof(char)*
(strlen(pszSerializedFilter)+3)); (strlen(pszSerializedFilter)+3));
sprintf(pszTmp, "(%s)", pszSerializedFilter); sprintf(pszTmp, "(%s)", pszSerializedFilter);
free(pszSerializedFilter); CPLFree(pszSerializedFilter);


if (wfsparams->pszFilter == NULL) if (wfsparams->pszFilter == NULL)
wfsparams->pszFilter = msStrdup(pszTmp); wfsparams->pszFilter = msStrdup(pszTmp);
Expand Down

0 comments on commit c0f8907

Please sign in to comment.