]> the.earth.li Git - onak.git/commitdiff
Fix memory leak in makewordlistfromkey()
authorJonathan McDowell <noodles@earth.li>
Sun, 18 Aug 2019 17:49:47 +0000 (18:49 +0100)
committerJonathan McDowell <noodles@earth.li>
Sun, 18 Aug 2019 17:49:47 +0000 (18:49 +0100)
We were building a linked list of words in each UID, but then not
cleaning up this linked list when we were done with it. Found with gcc
-fsanitize=leak

wordlist.c

index 0feeb8217833eb6b375a9fce8d5c81de42dcf5e9..6827ba282db2ecc5a7a64e2a02238d4a85991c27 100644 (file)
@@ -106,6 +106,7 @@ struct ll *makewordlistfromkey(struct ll *wordlist,
                                wordlist = lladd(wordlist, strdup(wl->object));
                        }
                }
+               llfree(words, NULL);
                free(uids[i]);
                uids[i] = NULL;
        }