X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=csum-file.c;h=c66b9eb10bfad8fee8b7b779cbb4a8e7c86480af;hb=edde7a8b5324d88f07fcb8204da313c19b4988fa;hp=c8c7369152cd2b744aae488eb794c12ffbdfe9b9;hpb=f4b3a4c30b5ea3a5de2a2597a3c53266017d02ba;p=git.git diff --git a/csum-file.c b/csum-file.c index c8c73691..c66b9eb1 100644 --- a/csum-file.c +++ b/csum-file.c @@ -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; } @@ -86,7 +87,7 @@ struct sha1file *sha1create(const char *fmt, ...) die("you wascally wabbit, you"); f->namelen = len; - fd = open(f->name, O_CREAT | O_EXCL | O_WRONLY, 0644); + fd = open(f->name, O_CREAT | O_EXCL | O_WRONLY, 0666); if (fd < 0) die("unable to open %s (%s)", f->name, strerror(errno)); f->fd = fd;