summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2010-12-06 09:58:01 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2010-12-06 09:58:01 +0000
commite08c6f44ba5c12476288b4a0dc0c85bc0508c92e (patch)
tree185a0098379c94d8251fae728c524689c873c304
parent5ab890d565600f0bd02bd6371c9e7773729f045a (diff)
downloadlibwapcaplet-e08c6f44ba5c12476288b4a0dc0c85bc0508c92e.tar.gz
libwapcaplet-e08c6f44ba5c12476288b4a0dc0c85bc0508c92e.tar.bz2
Ensure we cope with no chance to opportunistically initialise the hash before iteration. Also ensure that an OOM during initialise doesn't leave us at risk of doom later
svn path=/trunk/libwapcaplet/; revision=11018
-rw-r--r--src/libwapcaplet.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libwapcaplet.c b/src/libwapcaplet.c
index 5f7b402..3cac722 100644
--- a/src/libwapcaplet.c
+++ b/src/libwapcaplet.c
@@ -79,6 +79,7 @@ _lwc_initialise(void)
if (ctx->buckets == NULL) {
LWC_FREE(ctx);
+ ctx = NULL;
return lwc_error_oom;
}
@@ -323,7 +324,10 @@ lwc_iterate_strings(lwc_iteration_callback_fn cb, void *pw)
{
lwc_hash n;
lwc_string *str;
-
+
+ if (ctx == NULL)
+ return;
+
for (n = 0; n < ctx->bucketcount; ++n) {
for (str = ctx->buckets[n]; str != NULL; str = str->next)
cb(str, pw);