diff options
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sha1_file.c b/sha1_file.c index 4304fe9bbc..1978d5f14e 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2277,10 +2277,9 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, */ if ((type == OBJ_BLOB) && S_ISREG(st->st_mode)) { unsigned long nsize = size; - char *nbuf = buf; - if (convert_to_git(path, &nbuf, &nsize)) { - if (size) - munmap(buf, size); + char *nbuf = convert_to_git(path, buf, &nsize); + if (nbuf) { + munmap(buf, size); size = nsize; buf = nbuf; re_allocated = 1; |