[PATCH 13/15] builtin/unpack-file: fix a memleak
Signed-off-by: Stefan Beller <sbeller@google.com>
---
Notes:
This is for discussion again,
see 2nd previous patch.
However why do we close the fd when we know
the program ends soon? So let's also
free the memory. builtin/unpack-file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index 1920029..ea5767e 100644
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
@@ -17,6 +17,7 @@ static char *create_temp_file(unsigned char *sha1)
if (write_in_full(fd, buf, size) != size)
die_errno("unable to write temp-file");
close(fd);
+ free(buf);
return path;
}
--
2.3.0.81.gc37f363