Squash memory leak

svn path=/trunk/netsurf/; revision=3235
This commit is contained in:
John Mark Bell 2007-04-05 12:33:12 +00:00
parent 6eba75b1c6
commit f059818d74

View File

@ -2054,11 +2054,14 @@ 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;
c = urldb_search_match_host(root->data, data);
last = root;
if (c > 0) {
@ -2067,7 +2070,6 @@ struct search_node *urldb_search_remove(struct search_node *root,
deleted = root;
root->right = urldb_search_remove(root->right, data);
}
}
if (root == last) {
if (deleted != &empty &&
@ -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 ||