From f87c55c2647cf3aa0e6b5e45738facb6b62fe37c Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 11 Jun 2024 11:19:59 +0200 Subject: object-name: free leaking object contexts While it is documented in `struct object_context::path` that this variable needs to be released by the caller, this fact is rather easy to miss given that we do not ever provide a function to release the object context. And of course, while some callers dutifully release the path, many others don't. Introduce a new `object_context_release()` function that releases the path. Convert callsites that used to free the path to use that new function and add missing calls to callsites that were leaking memory. Refactor those callsites as required to have a single return path, only. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- list-objects-filter.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'list-objects-filter.c') diff --git a/list-objects-filter.c b/list-objects-filter.c index 4346f8da45..c95ec3509a 100644 --- a/list-objects-filter.c +++ b/list-objects-filter.c @@ -542,6 +542,8 @@ static void filter_sparse_oid__init( filter->filter_data = d; filter->filter_object_fn = filter_sparse; filter->free_fn = filter_sparse_free; + + object_context_release(&oc); } /* -- cgit v1.2.3