Permalink
Browse files

mapwfs.c: correctly pair CPL allocation routines with CPL free routines

  • Loading branch information...
1 parent 092c6d7 commit c0f89072684b69c7abd13c6f6c3f5c8ffd095624 @rouault rouault committed Apr 11, 2013
Showing with 7 additions and 3 deletions.
  1. +7 −3 mapwfs.c
View
@@ -34,6 +34,7 @@
/* There is a dependency to GDAL/OGR for the GML driver and MiniXML parser */
#include "cpl_minixml.h"
+#include "cpl_conv.h"
#include "mapogcfilter.h"
#include "mapowscommon.h"
@@ -3245,14 +3246,17 @@ int msWFSParseRequest(mapObj *map, cgiRequestObj *request, owsRequestObj *ows_re
psFilter = CPLGetXMLNode(psQuery, "Filter");
if (psFilter) {
- if (!bMultiLayer)
- wfsparams->pszFilter = CPLSerializeXMLTree(psFilter);
+ if (!bMultiLayer) {
+ char* pszCPLTmp = CPLSerializeXMLTree(psFilter);
+ wfsparams->pszFilter = msStrdup(pszCPLTmp);
+ CPLFree(pszCPLTmp);
+ }
else {
pszSerializedFilter = CPLSerializeXMLTree(psFilter);
pszTmp = (char *)msSmallMalloc(sizeof(char)*
(strlen(pszSerializedFilter)+3));
sprintf(pszTmp, "(%s)", pszSerializedFilter);
- free(pszSerializedFilter);
+ CPLFree(pszSerializedFilter);
if (wfsparams->pszFilter == NULL)
wfsparams->pszFilter = msStrdup(pszTmp);

0 comments on commit c0f8907

Please sign in to comment.