diff options
author | bviktor <bviktor@outlook.com> | 2012-10-02 13:02:17 -0700 |
---|---|---|
committer | bviktor <bviktor@outlook.com> | 2012-10-02 13:02:17 -0700 |
commit | c80858f919cd54b3f6721d2267b33dc3a91da474 (patch) | |
tree | c0b9de69542f9b6ebb7164edc88a59c45a786aa6 /src/common/tree.c | |
parent | 6e3efe262258204b8c0a5c1c3260e93c2588c20d (diff) | |
parent | 62903cd171acb49ed66056c32edbcc0fd56b07c5 (diff) |
Merge pull request #115 from RichardHitt/master
Fix memory leak related to url grabbing
Diffstat (limited to 'src/common/tree.c')
-rw-r--r-- | src/common/tree.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 |