summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/network/network_content.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index 7f6dd75ae..42077ca08 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -324,8 +324,14 @@ static bool GunzipFile(const ContentInfo *ci)
}
exit:
- if (fin != NULL) gzclose(fin);
- if (ftmp != NULL) fclose(ftmp);
+ if (fin != NULL) {
+ /* Closes ftmp too! */
+ gzclose(fin);
+ } else if (ftmp != NULL) {
+ /* In case the gz stream was opened correctly this will
+ * be closed by gzclose. */
+ fclose(ftmp);
+ }
if (fout != NULL) fclose(fout);
return ret;