diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-07-26 01:12:41 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-07-26 17:00:09 +0200 |
commit | d98d9c77e5d9ac0b0663069e05a512037b9279cf (patch) | |
tree | b2bbe8f00c92ed903eca6107776b272a233fd3f1 /mailmap.c | |
parent | Git 2.46-rc2 (diff) | |
download | git-d98d9c77e5d9ac0b0663069e05a512037b9279cf.tar.xz git-d98d9c77e5d9ac0b0663069e05a512037b9279cf.zip |
mailmap: plug memory leak in read_mailmap_blob()
When a named object to read mailmap from is not a blob, the code
correctly errors out, but it forgot to free the object data before
doing so.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mailmap.c')
-rw-r--r-- | mailmap.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -201,8 +201,10 @@ static int read_mailmap_blob(struct string_list *map, const char *name) buf = repo_read_object_file(the_repository, &oid, &type, &size); if (!buf) return error("unable to read mailmap object at %s", name); - if (type != OBJ_BLOB) + if (type != OBJ_BLOB) { + free(buf); return error("mailmap is not a blob: %s", name); + } read_mailmap_string(map, buf); |