Skip to content

Commit

Permalink
Merge branch 'rs/maint-diff-fd-leak' into maint
Browse files Browse the repository at this point in the history
* rs/maint-diff-fd-leak:
  close file on error in read_mmfile()
  • Loading branch information
Junio C Hamano committed Dec 26, 2010
2 parents c2ed29b + 5fd8981 commit 26517de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xdiff-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 26517de

Please sign in to comment.