From: wessels <> Date: Wed, 13 Jun 2001 05:52:45 +0000 (+0000) Subject: Adrian noticed minor FD leaks if fstat() fails. X-Git-Tag: SQUID_3_0_PRE1~1495 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=053ea9f413220dbd54aed089c71da570754803fe;p=thirdparty%2Fsquid.git Adrian noticed minor FD leaks if fstat() fails. --- diff --git a/src/mime.cc b/src/mime.cc index 73570f866c..76e4ce518a 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -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; diff --git a/src/net_db.cc b/src/net_db.cc index 1a36a31420..554ec4833c 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -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);