Browse code

shared/tar.c: fix invalid close on error path - bb#1141

git-svn: trunk@4125

Tomasz Kojm authored on 2008/08/21 20:29:57
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Aug 21 13:24:17 CEST 2008 (tk)
2
+----------------------------------
3
+  * shared/tar.c: fix invalid close on error path - bb#1141
4
+
1 5
 Thu Aug 21 13:22:29 CEST 2008 (tk)
2 6
 ----------------------------------
3 7
   * libclamav/others.c: fix fd feak on error path - bb#1141
... ...
@@ -60,10 +60,8 @@ int tar_addfile(int fd, gzFile *gzs, const char *file)
60 60
 	unsigned int i, chksum = 0;
61 61
 
62 62
 
63
-    if((s = open(file, O_RDONLY|O_BINARY)) == -1) {
64
-	close(s);
63
+    if((s = open(file, O_RDONLY|O_BINARY)) == -1)
65 64
 	return -1;
66
-    }
67 65
 
68 66
     if(fstat(s, &sb) == -1) {
69 67
 	close(s);