]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-ref-store: plug memory leak in cmd_delete_refs
authorHan-Wen Nienhuys <hanwen@google.com>
Tue, 7 Dec 2021 13:38:15 +0000 (13:38 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Dec 2021 21:15:19 +0000 (13:15 -0800)
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-ref-store.c

index abb0ba101ae58b341fcfc0b0c5ec4a485b5971e8..8fee3cfce1aa674a23ac7513358e204155d81af2 100644 (file)
@@ -138,11 +138,14 @@ static int cmd_delete_refs(struct ref_store *refs, const char **argv)
        unsigned int flags = arg_flags(*argv++, "flags", transaction_flags);
        const char *msg = *argv++;
        struct string_list refnames = STRING_LIST_INIT_NODUP;
+       int result;
 
        while (*argv)
                string_list_append(&refnames, *argv++);
 
-       return refs_delete_refs(refs, msg, &refnames, flags);
+       result = refs_delete_refs(refs, msg, &refnames, flags);
+       string_list_clear(&refnames, 0);
+       return result;
 }
 
 static int cmd_rename_ref(struct ref_store *refs, const char **argv)