diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2007-04-05 12:33:12 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2007-04-05 12:33:12 +0000 |
commit | f059818d74bbf856ccb0674555c9c73f0c6e93e5 (patch) | |
tree | 659c9a5fcd8e2a2163aaa8438beabdaf8b3a276d /content/urldb.c | |
parent | 6eba75b1c623cd66d0a688ccf960ea0acc2a5b3f (diff) | |
download | netsurf-f059818d74bbf856ccb0674555c9c73f0c6e93e5.tar.gz netsurf-f059818d74bbf856ccb0674555c9c73f0c6e93e5.tar.bz2 |
Squash memory leak
svn path=/trunk/netsurf/; revision=3235
Diffstat (limited to 'content/urldb.c')
-rw-r--r-- | content/urldb.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/content/urldb.c b/content/urldb.c index 457dc7a90..e127db8b4 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -2054,19 +2054,21 @@ struct search_node *urldb_search_remove(struct search_node *root, const struct host_part *data) { static struct search_node *last, *deleted; + int c; assert(root && data); - if (root != &empty) { - int c = urldb_search_match_host(root->data, data); + if (root == &empty) + return root; - last = root; - if (c > 0) { - root->left = urldb_search_remove(root->left, data); - } else { - deleted = root; - root->right = urldb_search_remove(root->right, data); - } + c = urldb_search_match_host(root->data, data); + + last = root; + if (c > 0) { + root->left = urldb_search_remove(root->left, data); + } else { + deleted = root; + root->right = urldb_search_remove(root->right, data); } if (root == last) { @@ -2076,6 +2078,7 @@ struct search_node *urldb_search_remove(struct search_node *root, deleted->data = last->data; deleted = ∅ root = root->right; + free(last); } } else { if (root->left->level < root->level - 1 || |