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

[or-cvs] [tor/maint-0.2.1] Don't leak memory if we get too many create cells



Author: Roger Dingledine <arma@xxxxxxxxxxxxxx>
Date: Mon, 27 Jul 2009 22:38:09 -0400
Subject: Don't leak memory if we get too many create cells
Commit: 0a4e2397c0f184a1717ec7475381f9d12f189cb7

Specifically, every time we get a create cell but we have so many already
queued that we refuse it.

Bugfix on 0.2.0.19-alpha; fixes bug 1034. Reported by BarkerJr.
---
 ChangeLog          |    5 +++++
 src/or/cpuworker.c |    4 +++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5940492..fed57aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@ Changes in version 0.2.1.19 - 2009-07-??
     - Make accessing hidden services on 0.2.1.x work right
       again. Bugfix on 0.2.1.3-alpha; workaround for bug 1038.
 
+  o Minor bugfixes:
+    - Avoid leaking memory every time we get a create cell but we have
+      so many already queued that we refuse it. Bugfix on 0.2.0.19-alpha;
+      fixes bug 1034. Reported by BarkerJr.
+
 
 Changes in version 0.2.1.18 - 2009-07-24
   o Build fixes:
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 99829e8..219fb9d 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -444,8 +444,10 @@ assign_onionskin_to_cpuworker(connection_t *cpuworker,
   if (1) {
     if (num_cpuworkers_busy == num_cpuworkers) {
       log_debug(LD_OR,"No idle cpuworkers. Queuing.");
-      if (onion_pending_add(circ, onionskin) < 0)
+      if (onion_pending_add(circ, onionskin) < 0) {
+        tor_free(onionskin);
         return -1;
+      }
       return 0;
     }
 
-- 
1.5.6.5