diff --git a/xdiff-interface.c b/xdiff-interface.c
index e1e054e4d982de30d8a9c8c4109c6d62448f62a9..164581f87f49935f0d1b1885420960a4d11dea56 100644 (file)
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
return error("Could not open %s", filename);
sz = xsize_t(st.st_size);
ptr->ptr = xmalloc(sz ? sz : 1);
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);
return error("Could not read %s", filename);
+ }
fclose(f);
ptr->size = sz;
return 0;
fclose(f);
ptr->size = sz;
return 0;