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 +++++++++++++++---- desktop/searchweb.c | 7 +++++-- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'desktop') 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 diff --git a/desktop/searchweb.c b/desktop/searchweb.c index c6dfaa6df..2995627f6 100644 --- a/desktop/searchweb.c +++ b/desktop/searchweb.c @@ -77,9 +77,11 @@ bool search_is_url(const char *url) if (url_normalize(url, &url2) != URL_FUNC_OK) return false; - if (url_host(url2, &host) != URL_FUNC_OK) + if (url_host(url2, &host) != URL_FUNC_OK) { + free(url2); return false; - + } + free(url2); return true; } @@ -106,6 +108,7 @@ void search_web_provider_details(int reference) if (ref++ == (int)reference) break; } + fclose(f); if (current_search_provider.name != NULL) free(current_search_provider.name); current_search_provider.name = strdup(strtok(buf, "|")); -- cgit v1.2.3