avoid double free
This commit is contained in:
parent
b1c0d05404
commit
907751dfe1
1 changed files with 2 additions and 3 deletions
|
|
@ -66,11 +66,10 @@ int write_file(const char* base_path, const char *file, const void* buf, size_t
|
|||
res = fwrite(buf, 1, buf_sz, fp);
|
||||
if (res >= buf_sz) {
|
||||
printf("Written %d bytes to fine %s\n", res, fdir);
|
||||
|
||||
fclose(fp);
|
||||
} else {
|
||||
fprintf(stderr, "Cannot allocate %ld bytes for %s content.\n", len, fdir);
|
||||
fprintf(stderr, "Cannot write to %s: %d.\n", fdir, res);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
} else {
|
||||
fprintf(stderr, "Cannot open file %s.\n", fdir);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue