[or-cvs] [tor/master 2/7] Fix a memory leak, found by coverity

nickm at torproject.org nickm at torproject.org
Mon Feb 22 17:47:26 UTC 2010


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Mon, 22 Feb 2010 10:56:54 +0100
Subject: Fix a memory leak, found by coverity
Commit: dcf85eb158690354b5446bc8603460acc6f86f47

---
 src/or/control.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/or/control.c b/src/or/control.c
index b8e07a0..40ad4a2 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2100,16 +2100,18 @@ handle_control_extendcircuit(control_connection_t *conn, uint32_t len,
 
     if ((smartlist_len(args) == 1) ||
         (smartlist_len(args) >= 2 && is_keyval_pair(smartlist_get(args, 1)))) {
-        // "EXTENDCIRCUIT 0" || EXTENDCIRCUIT 0 foo=bar"
-        circ = circuit_launch_by_router(intended_purpose, NULL,
-                CIRCLAUNCH_NEED_CAPACITY);
-        if (!circ) {
-          connection_write_str_to_buf("551 Couldn't start circuit\r\n", conn);
-        } else {
-          connection_printf_to_buf(conn, "250 EXTENDED %lu\r\n",
-                    (unsigned long)circ->global_identifier);
-        }
-        goto done;
+      // "EXTENDCIRCUIT 0" || EXTENDCIRCUIT 0 foo=bar"
+      circ = circuit_launch_by_router(intended_purpose, NULL,
+                                      CIRCLAUNCH_NEED_CAPACITY);
+      if (!circ) {
+        connection_write_str_to_buf("551 Couldn't start circuit\r\n", conn);
+      } else {
+        connection_printf_to_buf(conn, "250 EXTENDED %lu\r\n",
+                  (unsigned long)circ->global_identifier);
+      }
+      SMARTLIST_FOREACH(args, char *, cp, tor_free(cp));
+      smartlist_free(args);
+      goto done;
     }
     // "EXTENDCIRCUIT 0 router1,router2" ||
     // "EXTENDCIRCUIT 0 router1,router2 PURPOSE=foo"
-- 
1.6.5




More information about the tor-commits mailing list