[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r6988: Close an fd leak on failed mmap() (in tor/trunk: . src/common)



Author: nickm
Date: 2006-08-05 13:53:32 -0400 (Sat, 05 Aug 2006)
New Revision: 6988

Modified:
   tor/trunk/
   tor/trunk/src/common/compat.c
Log:
 r7030@Kushana:  nickm | 2006-08-04 14:46:52 -0700
 Close an fd leak on failed mmap()



Property changes on: tor/trunk
___________________________________________________________________
Name: svk:merge
   - 1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:7014
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/mmap:7029
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950
   + 1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:7014
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/mmap:7030
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950

Modified: tor/trunk/src/common/compat.c
===================================================================
--- tor/trunk/src/common/compat.c	2006-08-05 17:53:21 UTC (rev 6987)
+++ tor/trunk/src/common/compat.c	2006-08-05 17:53:32 UTC (rev 6988)
@@ -134,6 +134,7 @@
 
   string = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0);
   if (string == MAP_FAILED) {
+    close(fd);
     log_warn(LD_FS,"Could not mmap file \"%s\": %s", filename,
              strerror(errno));
     return NULL;