Author: jmb
Date: Thu Apr 5 13:33:12 2007
New Revision: 3235
URL:
http://svn.semichrome.net?rev=3235&view=rev
Log:
Squash memory leak
Modified:
trunk/netsurf/content/urldb.c
Modified: trunk/netsurf/content/urldb.c
URL:
http://svn.semichrome.net/trunk/netsurf/content/urldb.c?rev=3235&r1=3...
==============================================================================
--- trunk/netsurf/content/urldb.c (original)
+++ trunk/netsurf/content/urldb.c Thu Apr 5 13:33:12 2007
@@ -2054,19 +2054,21 @@
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);
-
- 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 == &empty)
+ return root;
+
+ 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 @@
deleted->data = last->data;
deleted = ∅
root = root->right;
+ free(last);
}
} else {
if (root->left->level < root->level - 1 ||