aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/grep.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-05 12:09:31 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-05 08:49:12 -0700
commitee087c29c89ad54980f2521641f5f182f6adbc79 (patch)
treea9a1e82fc009128bc50c0c279f4ce5c22484367f /builtin/grep.c
parent149c83e0aa1ee75b2da9c27ce5a819025260b4da (diff)
downloadgit-ee087c29c89ad54980f2521641f5f182f6adbc79.tar.gz
builtin/grep: fix leaking object context
Even when `get_oid_with_context()` fails it may have allocated some data in the object context. But we do not release it in git-grep(1) when the call fails, leading to a memory leak. Plug it. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index dfc3c3e8bd..dda4582d64 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1133,6 +1133,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
&oid, &oc)) {
if (seen_dashdash)
die(_("unable to resolve revision: %s"), arg);
+ object_context_release(&oc);
break;
}