test-ref-store: plug memory leak in cmd_delete_refs
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Han-Wen Nienhuys committed
Dec 7, 2021 at 13:38 UTC
df25a19d7287798a4ab2b5df08377fe7492a3846
1 file changed
+4
-1
t/helper/test-ref-store.c
+4
-1
@@ -138,11 +138,14 @@ static int cmd_delete_refs(struct ref_store *refs, const char **argv)
138
unsigned int flags = arg_flags(*argv++, "flags", transaction_flags);
139
const char *msg = *argv++;
140
struct string_list refnames = STRING_LIST_INIT_NODUP;
141
+ int result;
142
143
while (*argv)
144
string_list_append(&refnames, *argv++);
145
145
- return refs_delete_refs(refs, msg, &refnames, flags);
146
+ result = refs_delete_refs(refs, msg, &refnames, flags);
147
+ string_list_clear(&refnames, 0);
148
+ return result;
149
}
150
151
static int cmd_rename_ref(struct ref_store *refs, const char **argv)