diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-12-26 11:18:39 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-12-26 11:18:39 -0800 |
commit | 26517dea245cc6332ffb80cf7747f6c211aa2e4d (patch) | |
tree | dfc1e285f9e30d7f2d4f81257dbc826a1cfb4727 /xdiff-interface.c | |
parent | c2ed29b49b557b7bba8be147551cdd6e22fd743b (diff) | |
parent | 5fd898141ce2a243abf75192c9a55cb0a4e1ba80 (diff) | |
download | git-26517dea245cc6332ffb80cf7747f6c211aa2e4d.tar.gz |
Merge branch 'rs/maint-diff-fd-leak' into maint
* rs/maint-diff-fd-leak:
close file on error in read_mmfile()
Diffstat (limited to 'xdiff-interface.c')
-rw-r--r-- | xdiff-interface.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c index e1e054e4d9..164581f87f 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -212,8 +212,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; |