diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-11-08 21:17:43 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-11-21 06:32:48 +0300 |
commit | e84a26e32faba0c2ae7a19fa9bf805645f620e82 (patch) | |
tree | 239a450569386ca23cb3480d06d0e91b1562aedf /builtin/unpack-file.c | |
parent | b6046abc0c27134d52c56699a88d1fadfe7e66ce (diff) |
unpack-file: fix ancient leak in create_temp_file()
Fix a leak that's been with us since 3407bb4940c (Add "unpack-file"
helper that unpacks a sha1 blob into a tmpfile., 2005-04-18). See
00c8fd493af (cat-file: use streaming API to print blobs, 2012-03-07)
for prior art which shows the same API pattern, i.e. free()-ing the
result of read_object_file() after it's used.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'builtin/unpack-file.c')
-rw-r--r-- | builtin/unpack-file.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c index 9e8119dd35..88de32b7d7 100644 --- a/builtin/unpack-file.c +++ b/builtin/unpack-file.c @@ -19,6 +19,7 @@ static char *create_temp_file(struct object_id *oid) if (write_in_full(fd, buf, size) < 0) die_errno("unable to write temp-file"); close(fd); + free(buf); return path; } |