Skip to content

Commit 528a762

Browse files
committed
Merge branch 'jc/leakfix-mailmap' into maint-2.46
Leakfix. * jc/leakfix-mailmap: mailmap: plug memory leak in read_mailmap_blob()
2 parents 88639e5 + d98d9c7 commit 528a762

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mailmap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,10 @@ static int read_mailmap_blob(struct string_list *map, const char *name)
201201
buf = repo_read_object_file(the_repository, &oid, &type, &size);
202202
if (!buf)
203203
return error("unable to read mailmap object at %s", name);
204-
if (type != OBJ_BLOB)
204+
if (type != OBJ_BLOB) {
205+
free(buf);
205206
return error("mailmap is not a blob: %s", name);
207+
}
206208

207209
read_mailmap_string(map, buf);
208210

t/t4203-mailmap.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test_description='.mailmap configurations'
55
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

8+
TEST_PASSES_SANITIZE_LEAK=true
89
. ./test-lib.sh
910

1011
test_expect_success 'setup commits and contacts file' '

0 commit comments

Comments
 (0)