diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-09-12 05:20:29 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-09-12 05:20:29 +0000 |
commit | 8d70ae01b8bd9d2203230d753b651f91c3afc123 (patch) | |
tree | f885bac609135961ceb79d939be4e10f1b34931b /src/common | |
parent | 63dfe2447ee4f283988c81c9025303503201d690 (diff) | |
download | tor-8d70ae01b8bd9d2203230d753b651f91c3afc123.tar tor-8d70ae01b8bd9d2203230d753b651f91c3afc123.tar.gz |
Fix a memory leak in smartlist_string_remove.
svn:r5002
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/container.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/container.c b/src/common/container.c index 74b2dd907..766e6deb9 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -121,7 +121,7 @@ void smartlist_remove(smartlist_t *sl, void *element) { } } -/** If there are any strings in sl equal to element, remove them. +/** If there are any strings in sl equal to element, remove and free them. * Does not preserve order. */ void smartlist_string_remove(smartlist_t *sl, const char *element) @@ -131,6 +131,7 @@ smartlist_string_remove(smartlist_t *sl, const char *element) 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 */ } |