From b75b2ae8bbeada1a364332596a759f4d0410a852 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 18 Dec 2009 20:15:50 +0000 Subject: Merge r9731:HEAD from branches/MarkieB/gtkmain to trunk. svn path=/trunk/netsurf/; revision=9737 --- desktop/search.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'desktop/search.c') diff --git a/desktop/search.c b/desktop/search.c index 018f40674..ba472fd41 100644 --- a/desktop/search.c +++ b/desktop/search.c @@ -97,13 +97,22 @@ static void free_matches(struct search_context *context); bool search_create_context(struct browser_window *bw, struct search_callbacks *callbacks, void *p) { - struct search_context *context = malloc(sizeof(struct search_context)); - struct list_entry *search_head = malloc(sizeof(struct list_entry)); + struct search_context *context; + struct list_entry *search_head; - if ((context == NULL) || (search_head == NULL)) { + context = malloc(sizeof(struct search_context)); + if (context == NULL) { warn_user("NoMemory", 0); return false; } + + search_head = malloc(sizeof(struct list_entry)); + if (search_head == NULL) { + warn_user("NoMemory", 0); + free(context); + return false; + } + if (bw->search_context != NULL) search_destroy_context(bw->search_context); @@ -195,8 +204,10 @@ void search_step(struct search_context *context, search_flags_t flags, void free_matches(struct search_context *context) { - struct list_entry *a = context->found->next; + struct list_entry *a; struct list_entry *b; + + a = context->found->next; /* empty the list before clearing and deleting the selections because the the clearing updates the -- cgit v1.2.3