]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Adrian noticed minor FD leaks if fstat() fails.
authorwessels <>
Wed, 13 Jun 2001 05:52:45 +0000 (05:52 +0000)
committerwessels <>
Wed, 13 Jun 2001 05:52:45 +0000 (05:52 +0000)
src/mime.cc
src/net_db.cc

index 73570f866c84ea00248a1931f997b72484ef2d55..76e4ce518ac6dbbd6d2468c69f862bc9153951b0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mime.cc,v 1.100 2001/04/14 00:03:23 hno Exp $
+ * $Id: mime.cc,v 1.101 2001/06/12 23:52:45 wessels Exp $
  *
  * DEBUG: section 25    MIME Parsing
  * AUTHOR: Harvest Derived
@@ -416,6 +416,7 @@ mimeLoadIconFile(const char *icon)
     }
     if (fstat(fd, &sb) < 0) {
        debug(50, 0) ("mimeLoadIconFile: FD %d: fstat: %s\n", fd, xstrerror());
+       file_close(fd);
        return;
     }
     flags = null_request_flags;
index 1a36a3142061cffd840ccc7e55dda92c9c333b4c..554ec4833cd5196c7879d8928a0e8909b09ded54 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: net_db.cc,v 1.157 2001/03/03 10:39:33 hno Exp $
+ * $Id: net_db.cc,v 1.158 2001/06/12 23:52:45 wessels Exp $
  *
  * DEBUG: section 38    Network Measurement Database
  * AUTHOR: Duane Wessels
@@ -438,8 +438,10 @@ netdbReloadState(void)
     fd = file_open(path, O_RDONLY | O_TEXT);
     if (fd < 0)
        return;
-    if (fstat(fd, &sb) < 0)
+    if (fstat(fd, &sb) < 0) {
+       file_close(fd);
        return;
+    }
     t = buf = xcalloc(1, sb.st_size + 1);
     l = read(fd, buf, sb.st_size);
     file_close(fd);