Skip to content

Instantly share code, notes, and snippets.

@gogglesguy
Created September 14, 2016 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gogglesguy/10c9745c98adff0bbd0ba93f777bf209 to your computer and use it in GitHub Desktop.
Save gogglesguy/10c9745c98adff0bbd0ba93f777bf209 to your computer and use it in GitHub Desktop.
diff --git a/mapfile.c b/mapfile.c
index 731498a..50e8c46 100644
--- a/mapfile.c
+++ b/mapfile.c
@@ -6973,11 +6973,14 @@ int msUpdateMapFromURL(mapObj *map, char *variable, char *string)
static void hashTableSubstituteString(hashTableObj *hash, const char *from, const char *to) {
const char *key, *val;
+ char *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);
+ free(new_val);
}
key = msNextKeyFromHashTable(hash, key);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment