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

[or-cvs] r8413: minimal backport: don't crash when extendcircuit gets a thir (tor/branches/tor-0_1_1-patches/src/or)



Author: arma
Date: 2006-09-18 00:29:59 -0400 (Mon, 18 Sep 2006)
New Revision: 8413

Modified:
   tor/branches/tor-0_1_1-patches/src/or/control.c
Log:
minimal backport: don't crash when extendcircuit gets a third arg.


Modified: tor/branches/tor-0_1_1-patches/src/or/control.c
===================================================================
--- tor/branches/tor-0_1_1-patches/src/or/control.c	2006-09-18 04:24:41 UTC (rev 8412)
+++ tor/branches/tor-0_1_1-patches/src/or/control.c	2006-09-18 04:29:59 UTC (rev 8413)
@@ -1703,18 +1703,20 @@
     }
     smartlist_split_string(router_nicknames, smartlist_get(args,1), ",", 0, 0);
 
-    SMARTLIST_FOREACH(args, char *, cp, tor_free(cp));
-    smartlist_free(args);
-    if (!zero_circ && !circ) {
-      goto done;
-    }
     if (zero_circ && smartlist_len(args)>2) {
       if (get_purpose(smartlist_get(args,2), 1, &intended_purpose) < 0) {
         connection_printf_to_buf(conn, "552 Unknown purpose \"%s\"\r\n",
                                  (char *)smartlist_get(args,2));
+        SMARTLIST_FOREACH(args, char *, cp, tor_free(cp));
+        smartlist_free(args);
         goto done;
       }
     }
+    SMARTLIST_FOREACH(args, char *, cp, tor_free(cp));
+    smartlist_free(args);
+    if (!zero_circ && !circ) {
+      goto done;
+    }
   }
 
   routers = smartlist_create();