зеркало из https://github.com/microsoft/git.git
Merge branch 'rs/maint-diff-fd-leak' into maint
* rs/maint-diff-fd-leak: close file on error in read_mmfile()
This commit is contained in:
Коммит
26517dea24
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче