[or-cvs] point out a potential thread/process leak problem when we"r...
Roger Dingledine
arma at seul.org
Thu Feb 3 07:35:27 UTC 2005
Update of /home2/or/cvsroot/tor/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/common
Modified Files:
util.c
Log Message:
point out a potential thread/process leak problem when we're out of memory
Index: util.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- util.c 3 Feb 2005 07:25:10 -0000 1.198
+++ util.c 3 Feb 2005 07:35:24 -0000 1.199
@@ -103,6 +103,9 @@
/** Allocate a chunk of <b>size</b> bytes of memory, and return a pointer to
* result. On error, log and terminate the process. (Same as malloc(size),
* but never returns NULL.)
+ *
+ * <b>file</b> and <b>line</b> are used if dmalloc is enabled, and
+ * ignored otherwise.
*/
void *_tor_malloc(const char *file, const int line, size_t size) {
void *result;
@@ -115,6 +118,8 @@
if (!result) {
log_fn(LOG_ERR, "Out of memory. Dying.");
+ /* XXX if these functions die within a worker process, they won't
+ * call spawn_exit */
exit(1);
}
// memset(result,'X',size); /* deadbeef to encourage bugs */
More information about the tor-commits
mailing list