From e08c6f44ba5c12476288b4a0dc0c85bc0508c92e Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Mon, 6 Dec 2010 09:58:01 +0000 Subject: 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 --- src/libwapcaplet.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3