fix crash in printxmldoc, fixes #514

Thu, 28 Nov 2024 17:20:19 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 28 Nov 2024 17:20:19 +0100
changeset 849
c949c6ab5346
parent 848
b71598a22e11
child 850
bbe2925eb590

fix crash in printxmldoc, fixes #514

dav/main.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Thu Nov 28 17:18:43 2024 +0100
+++ b/dav/main.c	Thu Nov 28 17:20:19 2024 +0100
@@ -2402,7 +2402,7 @@
     CxMap *nsmap = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 16);
     cxDefineDestructor(nsmap, free);
     
-    cxMapPut(nsmap, cx_hash_key_str(rootns), "x0");
+    cxMapPut(nsmap, cx_hash_key_str(rootns), strdup("x0"));
     fprintf(out, "%s", "<?xml version=\"1.0\"?>\n");
     fprintf(out, "<x0:%s xmlns:x0=\"%s\">", root, rootns);
     
@@ -2411,7 +2411,6 @@
     fprintf(out, "</x0:%s>\n", root);
     
     // cleanup namespace map
-    cxMapRemove(nsmap, cx_hash_key_str(rootns));
     cxMapDestroy(nsmap);
 }
 

mercurial