Skip to content

Commit

Permalink
avoid leak and unnecessary usage of onlineresource in template output
Browse files Browse the repository at this point in the history
  • Loading branch information
tbonfort committed Sep 18, 2012
1 parent afa0b60 commit f44a2d1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions maptemplate.c
Expand Up @@ -3570,13 +3570,16 @@ static char *processLine(mapservObj *mapserv, char *instr, FILE *stream, int mod
outstr = msReplaceSubstring(outstr, "[map]", repstr);
}

if(strstr(outstr,"[mapserv_onlineresource]")) {
char *ol;
#if defined(USE_WMS_SVR) || defined (USE_WFS_SVR) || defined (USE_WCS_SVR) || defined(USE_SOS_SVR) || defined(USE_WMS_LYR) || defined(USE_WFS_LYR)
outstr = msReplaceSubstring(outstr, "[mapserv_onlineresource]",
msOWSGetOnlineResource(mapserv->map, "O", "onlineresource", mapserv->request));
ol = msOWSGetOnlineResource(mapserv->map, "O", "onlineresource", mapserv->request);
#else
outstr = msReplaceSubstring(outstr, "[mapserv_onlineresource]",
msBuildOnlineResource(mapserv->map, mapserv->request));
ol = msBuildOnlineResource(mapserv->map, mapserv->request);
#endif
outstr = msReplaceSubstring(outstr, "[mapserv_onlineresource]",ol);
msFree(ol);
}

if(getenv("HTTP_HOST")) {
snprintf(repstr, PROCESSLINE_BUFLEN, "%s", getenv("HTTP_HOST"));
Expand Down

0 comments on commit f44a2d1

Please sign in to comment.