From: Patrick Steinhardt Date: Wed, 20 Nov 2024 13:39:50 +0000 (+0100) Subject: global: drop `UNLEAK()` annotation X-Git-Tag: v2.48.0-rc0~37^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d91a9db33c53744b3d1034926edda7846442bc9e;p=thirdparty%2Fgit.git global: drop `UNLEAK()` annotation There are two users of `UNLEAK()` left in our codebase: - In "builtin/clone.c", annotating the `repo` variable. That leak has already been fixed though as you can see in the context, where we do know to free `repo_to_free`. - In "builtin/diff.c", to unleak entries of the `blob[]` array. That leak has also been fixed, because the entries we assign to that array come from `rev.pending.objects`, and we do eventually release `rev`. This neatly demonstrates one of the issues with `UNLEAK()`: it is quite easy for the annotation to become stale. A second issue is that its whole intent is to paper over leaks. And while that has been a necessary evil in the past, because Git was leaking left and right, it isn't really much of an issue nowadays where our test suite has no known leaks anymore. Remove the last two users of this macro. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/builtin/clone.c b/builtin/clone.c index 59fcb317a6..e851b1475d 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -1586,7 +1586,6 @@ int cmd_clone(int argc, free(dir); free(path); free(repo_to_free); - UNLEAK(repo); junk_mode = JUNK_LEAVE_ALL; transport_ls_refs_options_release(&transport_ls_refs_options); diff --git a/builtin/diff.c b/builtin/diff.c index dca52d4221..2fe92f373e 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -628,6 +628,5 @@ int cmd_diff(int argc, release_revisions(&rev); object_array_clear(&ent); symdiff_release(&sdiff); - UNLEAK(blob); return result; }