]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a couple of small memory leaks on failure cases.
authorNick Mathewson <nickm@torproject.org>
Wed, 3 Sep 2014 14:59:39 +0000 (10:59 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 3 Sep 2014 14:59:39 +0000 (10:59 -0400)
[CID 12347021234703]

src/or/control.c
src/or/microdesc.c

index 053c00b0699f223bc9df64e4f9274192a8da8a85..cd2df5ac344a7817f40a68800c1356cf2d2f6b2e 100644 (file)
@@ -1201,6 +1201,10 @@ handle_control_authenticate(control_connection_t *conn, uint32_t len,
   tor_free(password);
   connection_printf_to_buf(conn, "515 Authentication failed: %s\r\n", errstr);
   connection_mark_for_close(TO_CONN(conn));
+  if (sl) { /* clean up */
+    SMARTLIST_FOREACH(sl, char *, cp, tor_free(cp));
+    smartlist_free(sl);
+  }
   return 0;
  ok:
   log_info(LD_CONTROL, "Authenticated control connection ("TOR_SOCKET_T_FORMAT
index ed586f37c26fc476a7d6bc5a1df2dea74665cf3d..576fed0066df3074717550cb58671be0af201557 100644 (file)
@@ -576,6 +576,7 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force)
         microdesc_wipe_body(md);
       }
     }
+    smartlist_free(wrote);
     return -1;
   }