libidav/pwdstore.c

changeset 852
83fdf679df99
parent 842
10ee615ca557
--- a/libidav/pwdstore.c	Thu Nov 28 17:53:13 2024 +0100
+++ b/libidav/pwdstore.c	Mon Jan 06 21:18:36 2025 +0100
@@ -224,11 +224,11 @@
     if(ret) {
         pwdstore_put_index(p, id, locations);
         if(cxListSize(locations) == 0) {
-            cxListDestroy(locations);
+            cxListFree(locations);
         }
     } else {
         if(id) free(id);
-        cxListDestroy(locations);
+        cxListFree(locations);
     }
     
     return ret;
@@ -285,12 +285,14 @@
     remove_list_entries(s, id);
     
     CxHashKey key = cx_hash_key_str(id);
-    PwdIndexEntry *i = cxMapRemoveAndGet(s->index, key);
-    PwdEntry *e = cxMapRemoveAndGet(s->ids, key);
+    PwdIndexEntry *i = NULL;
+    cxMapRemoveAndGet(s->index, key, &i);
+    PwdEntry *e = NULL;
+    cxMapRemoveAndGet(s->ids, key, &e);
     
     if(i) {
         if(i->locations) {
-            cxListDestroy(i->locations);
+            cxListFree(i->locations);
         }
         free(i->id);
         free(i);
@@ -396,9 +398,9 @@
 
 void pwdstore_free(PwdStore* p) {
     cxDefineDestructor(p->ids, pwdstore_free_entry);
-    cxMapDestroy(p->ids);
+    cxMapFree(p->ids);
     
-    cxListDestroy(p->locations);
+    cxListFree(p->locations);
     
     if(p->content) {
         cxBufferFree(p->content);

mercurial