1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-28 04:49:43 +01:00

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>
This commit is contained in:
Patrick Steinhardt 2024-08-01 12:38:30 +02:00 committed by Junio C Hamano
parent 5a1e1e5d40
commit ed041007f0
2 changed files with 2 additions and 0 deletions

View file

@ -529,6 +529,7 @@ static void describe_blob(struct object_id oid, struct strbuf *dst)
traverse_commit_list(&revs, process_commit, process_object, &pcd); traverse_commit_list(&revs, process_commit, process_object, &pcd);
reset_revision_walk(); reset_revision_walk();
release_revisions(&revs); release_revisions(&revs);
strvec_clear(&args);
} }
static void describe(const char *arg, int last_one) static void describe(const char *arg, int last_one)

View file

@ -8,6 +8,7 @@ test_description='test git-specific bash prompt functions'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./lib-bash.sh . ./lib-bash.sh
. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh" . "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"