]> git.ipfire.org Git - thirdparty/git.git/commitdiff
shallow: free local object_array allocations
authorSamo Pogačnik <samo_pogacnik@t-2.net>
Fri, 16 Jan 2026 22:31:00 +0000 (22:31 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 16 Jan 2026 23:44:26 +0000 (15:44 -0800)
The local object_array 'stack' in get_shallow_commits() function
does not free its dynamic elements before the function returns.
As a result elements remain allocated and their reference forgotten.

Also note, that test 'fetching deepen beyond merged branch' added by
'shallow: handling fetch relative-deepen' patch fails without this
correction in linux-leaks and linux-reftable-leaks test runs.

Signed-off-by: Samo Pogačnik <samo_pogacnik@t-2.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
shallow.c

index 186e9178f32c33e91dc2ab7f4a4439dfbf8361ea..d37d2bc1798036f501afbc6b5e02da79b728eac8 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -198,6 +198,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
                }
        }
        deep_clear_commit_depth(&depths, free_depth_in_slab);
+       object_array_clear(&stack);
 
        return result;
 }