builtin/describe: fix trivial memory leak when describing blob
We never free the `struct strvec args` variable in `describe_blob()`, which thus causes a memory leak. Fix this. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Aug 1, 2024 at 12:38 UTC
ed041007f09f34585db3e248082e8c7083c257dc
2 files changed
+2
builtin/describe.c
+1
@@ -529,6 +529,7 @@ static void describe_blob(struct object_id oid, struct strbuf *dst)
529
traverse_commit_list(&revs, process_commit, process_object, &pcd);
530
reset_revision_walk();
531
release_revisions(&revs);
532
+ strvec_clear(&args);
533
}
534
535
static void describe(const char *arg, int last_one)
t/t9903-bash-prompt.sh
+1
@@ -8,6 +8,7 @@ test_description='test git-specific bash prompt functions'
8
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
9
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
11
+TEST_PASSES_SANITIZE_LEAK=true
12
. ./lib-bash.sh
13
14
. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"