Skip to content

Commit

Permalink
fix memory leak on hashTableSubstituteString (#5325)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbonfort committed Sep 15, 2016
1 parent 66309ee commit fd55fd3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -6972,12 +6972,14 @@ int msUpdateMapFromURL(mapObj *map, char *variable, char *string)
}

static void hashTableSubstituteString(hashTableObj *hash, const char *from, const char *to) {
const char *key, *val;
const char *key, *val, *new_val;
key = msFirstKeyFromHashTable(hash);
while(key != NULL) {
val = msLookupHashTable(hash, key);
if(strcasestr(val, from)) {
msInsertHashTable(hash, key, msCaseReplaceSubstring(msStrdup(val), from, to));
new_val = msCaseReplaceSubstring(msStrdup(val), from, to);
msInsertHashTable(hash, key, new_val);
msFree(new_val);
}
key = msNextKeyFromHashTable(hash, key);
}
Expand Down

0 comments on commit fd55fd3

Please sign in to comment.