aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-02-03 07:35:24 +0000
committerRoger Dingledine <arma@torproject.org>2005-02-03 07:35:24 +0000
commit051cda803e917cabaa4f8addb5079eca0066fc58 (patch)
treedadadeb708591eb59b5878c09597ead6a25aaa8f /src/common
parentbcece3d8a7564eb872d8bf02b4bf8838a9b871ba (diff)
downloadtor-051cda803e917cabaa4f8addb5079eca0066fc58.tar
tor-051cda803e917cabaa4f8addb5079eca0066fc58.tar.gz
point out a potential thread/process leak problem when we're out of memory
svn:r3512
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 72ff2e570..3f3fb8b6a 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -103,6 +103,9 @@ const char util_c_id[] = "$Id$";
/** 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 @@ void *_tor_malloc(const char *file, const int line, size_t size) {
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 */