From 62903cd171acb49ed66056c32edbcc0fd56b07c5 Mon Sep 17 00:00:00 2001 From: RichardHitt Date: Mon, 1 Oct 2012 12:53:25 -0700 Subject: Fix memory leak related to url grabbing --- src/common/tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/common/tree.c') diff --git a/src/common/tree.c b/src/common/tree.c index 0a459779..33fe1d41 100644 --- a/src/common/tree.c +++ b/src/common/tree.c @@ -150,10 +150,11 @@ tree_find (tree *t, void *key, tree_cmp_func *cmp, void *data, int *pos) return mybsearch (key, &t->array[0], t->elements, cmp, data, pos); } -void +void * tree_remove_at_pos (tree *t, int pos) { int post_bytes; + void *ret = t->array[pos]; t->elements--; if (pos != t->elements) @@ -161,6 +162,7 @@ tree_remove_at_pos (tree *t, int pos) post_bytes = (t->elements - pos) * sizeof (void *); memmove (&t->array[pos], &t->array[pos + 1], post_bytes); } + return ret; } int -- cgit 1.4.1