Skip to content

Commit ed04100

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5a1e1e5 commit ed04100

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

builtin/describe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ static void describe_blob(struct object_id oid, struct strbuf *dst)
529529
traverse_commit_list(&revs, process_commit, process_object, &pcd);
530530
reset_revision_walk();
531531
release_revisions(&revs);
532+
strvec_clear(&args);
532533
}
533534

534535
static void describe(const char *arg, int last_one)

t/t9903-bash-prompt.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_description='test git-specific bash prompt functions'
88
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
99
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1010

11+
TEST_PASSES_SANITIZE_LEAK=true
1112
. ./lib-bash.sh
1213

1314
. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"

0 commit comments

Comments
 (0)