fix missing strdup in pwdstore_clone

Mon, 28 Oct 2024 16:45:18 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 28 Oct 2024 16:45:18 +0100
changeset 842
10ee615ca557
parent 841
21403bdaf54c
child 843
5afacd2a8cde
child 845
8ac8bf29e2ee

fix missing strdup in pwdstore_clone

libidav/pwdstore.c file | annotate | diff | comparison | revisions
--- a/libidav/pwdstore.c	Mon Oct 28 15:22:28 2024 +0100
+++ b/libidav/pwdstore.c	Mon Oct 28 16:45:18 2024 +0100
@@ -140,11 +140,7 @@
     CxIterator i = cxMapIterator(p->ids);
     cx_foreach(CxMapEntry *, e, i) {
         PwdEntry *entry = e->value;
-        PwdEntry *new_entry = malloc(sizeof(PwdEntry));
-        new_entry->id = strdup(entry->id);
-        new_entry->user = entry->user ? strdup(entry->user) : NULL;
-        new_entry->password = entry->password ? strdup(entry->password) : NULL;
-        cxMapPut(newp->ids, *e->key, new_entry);
+        pwdstore_put(newp, entry->id, entry->user, entry->password);
     }
     
     i = cxMapIterator(p->index);
@@ -158,7 +154,7 @@
                 cxListAdd(locations, strdup(location));
             }
         }        
-        pwdstore_put_index(newp, entry->id, locations);
+        pwdstore_put_index(newp, strdup(entry->id), locations);
     }
     
     return newp;

mercurial