[or-cvs] r13489: backport r13488 (in tor/branches/tor-0_1_2-patches: . src/common)
arma at seul.org
arma at seul.org
Wed Feb 13 07:25:28 UTC 2008
Author: arma
Date: 2008-02-13 02:25:27 -0500 (Wed, 13 Feb 2008)
New Revision: 13489
Modified:
tor/branches/tor-0_1_2-patches/ChangeLog
tor/branches/tor-0_1_2-patches/src/common/compat.c
Log:
backport r13488
Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog 2008-02-13 07:23:37 UTC (rev 13488)
+++ tor/branches/tor-0_1_2-patches/ChangeLog 2008-02-13 07:25:27 UTC (rev 13489)
@@ -13,6 +13,8 @@
Resolves bug 597.
- Fix a few memory leaks that could in theory happen under bizarre error
conditions.
+ - We were leaking a file descriptor if Tor started with a zero-length
+ cached-descriptors file. Patch by freddy77.
Changes in version 0.1.2.19 - 2008-01-17
Modified: tor/branches/tor-0_1_2-patches/src/common/compat.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/common/compat.c 2008-02-13 07:23:37 UTC (rev 13488)
+++ tor/branches/tor-0_1_2-patches/src/common/compat.c 2008-02-13 07:25:27 UTC (rev 13489)
@@ -158,19 +158,18 @@
/* Zero-length file. If we call mmap on it, it will succeed but
* return NULL, and bad things will happen. So just fail. */
log_info(LD_FS,"File \"%s\" is empty. Ignoring.",filename);
+ close(fd);
return NULL;
}
string = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0);
+ close(fd);
if (string == MAP_FAILED) {
- close(fd);
log_warn(LD_FS,"Could not mmap file \"%s\": %s", filename,
strerror(errno));
return NULL;
}
- close(fd);
-
res = tor_malloc_zero(sizeof(tor_mmap_impl_t));
res->base.data = string;
res->base.size = filesize;
More information about the tor-commits
mailing list