mirror of https://github.com/BOINC/boinc.git
Merge pull request #4850 from jellythefish/fix-coverity-tool-issues
fix resource leakage in stage_file in writing to gzip
This commit is contained in:
commit
777f50e3c5
|
@ -141,15 +141,15 @@ int stage_file(
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int bytes = gzwrite(gz, file_buf.str().c_str(), file_buf.str().size());
|
int bytes = gzwrite(gz, file_buf.str().c_str(), file_buf.str().size());
|
||||||
if (!bytes) {
|
|
||||||
fprintf(stderr, "failed to write to gz: %s\n", strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
retval = gzclose(gz);
|
retval = gzclose(gz);
|
||||||
if (retval != Z_OK) {
|
if (retval != Z_OK) {
|
||||||
fprintf(stderr, "failed to close gz\n");
|
fprintf(stderr, "failed to close gz\n");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
if (!bytes) {
|
||||||
|
fprintf(stderr, "failed to write to gz: %s\n", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stdout, "created .gzip file for %s\n", dl_hier_path);
|
fprintf(stdout, "created .gzip file for %s\n", dl_hier_path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue