]> the.earth.li Git - onak.git/commitdiff
Fix up memory leaks in fs keydb backend deletion
authorJonathan McDowell <noodles@earth.li>
Sun, 18 Aug 2019 18:03:44 +0000 (19:03 +0100)
committerJonathan McDowell <noodles@earth.li>
Sun, 18 Aug 2019 18:03:44 +0000 (19:03 +0100)
We need to clean up the wordlist we created, as well as the copy of the
actual key we retrieved.

keydb_fs.c

index 01874ee4188da6e1d483a8fffb7bc7115e47ba70..aabb616e7efcd9e3dd82ab567708e8b31e7fb5a8 100644 (file)
@@ -435,6 +435,8 @@ static int fs_delete_key(struct onak_dbctx *dbctx,
 
                        wl = wl->next;
                }
+               llfree(wordlist, free);
+               wordlist = NULL;
 
                subkeyids = keysubkeys(pk);
                i = 0;
@@ -463,6 +465,8 @@ static int fs_delete_key(struct onak_dbctx *dbctx,
        keypath(buffer, sizeof(buffer), keyid, dbctx->config->location);
        unlink(buffer);
 
+       free_publickey(pk);
+
        if (!intrans)
                fs_endtrans(dbctx);
        return 1;