[or-cvs] [tor/master] Fix memory leak

Nick Mathewson nickm at seul.org
Sun Sep 27 16:11:21 UTC 2009


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Sat, 26 Sep 2009 15:38:52 +0200
Subject: Fix memory leak
Commit: 7f1f6984daba22c4e95d9338a4b4433c142ebd23

Some memory could be lost in the error case of
circuit_build_times_parse_state.

Found by Coverity
---
 ChangeLog             |    2 ++
 src/or/circuitbuild.c |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bf1a4ca..451a20c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,8 @@ Changes in version 0.2.2.4-alpha - 2009-??-??
   o Minor bugfixes:
     - Fix a couple of smaller issues with gathering statistics. Bugfixes
       on 0.2.2.1-alpha.
+    - Fix two memory leaks in the error case of
+      circuit_build_times_parse_state. Bugfix on 0.2.2.2-alpha.
 
 Changes in version 0.2.2.3-alpha - 2009-09-23
   o Major bugfixes:
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index adf53a8..5c3a86c 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -427,6 +427,8 @@ circuit_build_times_parse_state(circuit_build_times_t *cbt,
       if (!ok) {
         *msg = tor_strdup("Unable to parse circuit build times: "
                           "Unparsable bin number");
+        SMARTLIST_FOREACH(args, char*, cp, tor_free(cp));
+        smartlist_free(args);
         break;
       }
       count = (uint32_t)tor_parse_ulong(count_str, 0, 0,
@@ -434,6 +436,8 @@ circuit_build_times_parse_state(circuit_build_times_t *cbt,
       if (!ok) {
         *msg = tor_strdup("Unable to parse circuit build times: "
                           "Unparsable bin count");
+        SMARTLIST_FOREACH(args, char*, cp, tor_free(cp));
+        smartlist_free(args);
         break;
       }
 
-- 
1.5.6.5




More information about the tor-commits mailing list