[PATCH] Plug memory leak in sha1close()
authorSergey Vlasov <vsu@altlinux.ru>
Mon, 8 Aug 2005 18:46:13 +0000 (22:46 +0400)
committerJunio C Hamano <junkio@cox.net>
Tue, 9 Aug 2005 05:51:46 +0000 (22:51 -0700)
sha1create() and sha1fd() malloc the returned struct sha1file;
sha1close() should free it.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
csum-file.c

index 907efbf..c66b9eb 100644 (file)
@@ -45,6 +45,7 @@ int sha1close(struct sha1file *f, unsigned char *result, int update)
                sha1flush(f, 20);
        if (close(f->fd))
                die("%s: sha1 file error on close (%s)", f->name, strerror(errno));
+       free(f);
        return 0;
 }