[or-cvs] Backport: Fix a memory leak in smartlist_string_remove.

Nick Mathewson nickm at seul.org
Mon Sep 12 05:23:02 UTC 2005


Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv4776/src/common

Modified Files:
      Tag: tor-0_1_0-patches
	container.c 
Log Message:
Backport: Fix a memory leak in smartlist_string_remove.

Index: container.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/container.c,v
retrieving revision 1.25.2.1
retrieving revision 1.25.2.2
diff -u -d -r1.25.2.1 -r1.25.2.2
--- container.c	19 Jul 2005 21:33:12 -0000	1.25.2.1
+++ container.c	12 Sep 2005 05:23:00 -0000	1.25.2.2
@@ -128,6 +128,7 @@
   tor_assert(element);
   for (i = 0; i < sl->num_used; ++i) {
     if (!strcmp(element, sl->list[i])) {
+      tor_free(sl->list[i]);
       sl->list[i] = sl->list[--sl->num_used]; /* swap with the end */
       i--; /* so we process the new i'th element */
     }



More information about the tor-commits mailing list