mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 13:37:02 +03:00
Squash memory leak
svn path=/trunk/netsurf/; revision=3235
This commit is contained in:
parent
6eba75b1c6
commit
f059818d74
@ -2054,19 +2054,21 @@ struct search_node *urldb_search_remove(struct search_node *root,
|
|||||||
const struct host_part *data)
|
const struct host_part *data)
|
||||||
{
|
{
|
||||||
static struct search_node *last, *deleted;
|
static struct search_node *last, *deleted;
|
||||||
|
int c;
|
||||||
|
|
||||||
assert(root && data);
|
assert(root && data);
|
||||||
|
|
||||||
if (root != &empty) {
|
if (root == &empty)
|
||||||
int c = urldb_search_match_host(root->data, data);
|
return root;
|
||||||
|
|
||||||
last = root;
|
c = urldb_search_match_host(root->data, data);
|
||||||
if (c > 0) {
|
|
||||||
root->left = urldb_search_remove(root->left, data);
|
last = root;
|
||||||
} else {
|
if (c > 0) {
|
||||||
deleted = root;
|
root->left = urldb_search_remove(root->left, data);
|
||||||
root->right = urldb_search_remove(root->right, data);
|
} else {
|
||||||
}
|
deleted = root;
|
||||||
|
root->right = urldb_search_remove(root->right, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root == last) {
|
if (root == last) {
|
||||||
@ -2076,6 +2078,7 @@ struct search_node *urldb_search_remove(struct search_node *root,
|
|||||||
deleted->data = last->data;
|
deleted->data = last->data;
|
||||||
deleted = ∅
|
deleted = ∅
|
||||||
root = root->right;
|
root = root->right;
|
||||||
|
free(last);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (root->left->level < root->level - 1 ||
|
if (root->left->level < root->level - 1 ||
|
||||||
|
Loading…
Reference in New Issue
Block a user