Skip to content

Commit 7bf058f

Browse files
sigprofJunio C Hamano
authored andcommitted
[PATCH] Plug memory leak in sha1close()
sha1create() and sha1fd() malloc the returned struct sha1file; sha1close() should free it. Signed-off-by: Sergey Vlasov <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bfc66da commit 7bf058f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

csum-file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ int sha1close(struct sha1file *f, unsigned char *result, int update)
4545
sha1flush(f, 20);
4646
if (close(f->fd))
4747
die("%s: sha1 file error on close (%s)", f->name, strerror(errno));
48+
free(f);
4849
return 0;
4950
}
5051

0 commit comments

Comments
 (0)