libidav/pwdstore.c

changeset 842
10ee615ca557
parent 841
21403bdaf54c
--- 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