Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
close file on error in read_mmfile()
author
René Scharfe
<rene.scharfe@lsrfire.ath.cx>
Sat, 25 Dec 2010 12:38:46 +0000
(13:38 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 26 Dec 2010 19:17:18 +0000
(11:17 -0800)
Reported in http://qa.debian.org/daca/cppcheck/sid/git_1.7.2.3-2.2.html
and in http://thread.gmane.org/gmane.comp.version-control.git/123042.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
xdiff-interface.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
abf411e
)
diff --git
a/xdiff-interface.c
b/xdiff-interface.c
index 01f14fb50f7cf1387898a0c8db44f966ce07b720..b78f757193368e612bd2194a608736971ed5749b 100644
(file)
--- a/
xdiff-interface.c
+++ b/
xdiff-interface.c
@@
-211,8
+211,10
@@
int read_mmfile(mmfile_t *ptr, const char *filename)
return error("Could not open %s", filename);
sz = xsize_t(st.st_size);
ptr->ptr = xmalloc(sz ? sz : 1);
- if (sz && fread(ptr->ptr, sz, 1, f) != 1)
+ if (sz && fread(ptr->ptr, sz, 1, f) != 1) {
+ fclose(f);
return error("Could not read %s", filename);
+ }
fclose(f);
ptr->size = sz;
return 0;