]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ref-filter: free memory from used_atom
authorOlga Telezhnaya <olyatelezhnaya@gmail.com>
Thu, 18 Oct 2018 07:28:54 +0000 (07:28 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Oct 2018 02:28:10 +0000 (11:28 +0900)
Release memory from used_atom variable for reducing number of memory
leaks.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c

index e1bcb4ca8a1977e97b26da47962dfcd3781a021e..70f1d13ab3beb0f6c9be811f57941b307d9efc70 100644 (file)
@@ -1996,6 +1996,10 @@ void ref_array_clear(struct ref_array *array)
 {
        int i;
 
+       for (i = 0; i < used_atom_cnt; i++)
+               free((char *)used_atom[i].name);
+       FREE_AND_NULL(used_atom);
+       used_atom_cnt = 0;
        for (i = 0; i < array->nr; i++)
                free_array_item(array->items[i]);
        FREE_AND_NULL(array->items);