From: Stefan Beller Date: Sat, 21 Mar 2015 00:28:10 GMT Subject: [PATCH 13/15] builtin/unpack-file: fix a memleak Message-ID: <1426897692-18322-14-git-send-email-sbeller@google.com> In-Reply-To: <1426897692-18322-1-git-send-email-sbeller@google.com> Signed-off-by: Stefan Beller --- 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