From 7d12ce9e6a2dd795c8dcdf94af37219ac94e9dde Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Sun, 8 Oct 2017 16:40:48 +0200 Subject: Free the fetch (and http.obj handle) when errored out or finished or aborted --- content/fetchers/httplib_kolibri.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'content/fetchers/httplib_kolibri.c') diff --git a/content/fetchers/httplib_kolibri.c b/content/fetchers/httplib_kolibri.c index f9a0d9531..1aae7e583 100644 --- a/content/fetchers/httplib_kolibri.c +++ b/content/fetchers/httplib_kolibri.c @@ -268,14 +268,17 @@ bool start_fetch(void *httpf) { bool abort_fetch(void *httpf) { LOG("aborting fetch 0x%x", ((struct httpfetcher *)httpf)->owner); - http_disconnect_asm(((struct httpfetcher *)httpf)->handle); remove_from_poll(((struct httpfetcher *) httpf)->handle); fetch_remove_from_queues(((struct httpfetcher *)httpf)->owner); - /* fetch_free(((struct httpfetcher *)httpf)->owner); */ + fetch_free(((struct httpfetcher *)httpf)->owner); return true; } bool free_fetch(void *httpf) { + LOG("free_fetch called for 0x%x", ((struct httpfetcher *)httpf)->owner); + debug_board_printf("Closing http connection in free_fetch\n"); + http_disconnect_asm((((struct httpfetcher *)httpf)->handle)); + LOG("Freeing fetch 0x%x", ((struct httpfetcher *)httpf)->owner); http_free_asm((((struct httpfetcher *)httpf)->handle)); free((struct httpfetcher *)httpf); @@ -384,7 +387,7 @@ void poll_fetch(lwc_string *scheme) { t->headercbdone = true; remove_from_poll(t->handle); fetch_remove_from_queues(t->owner); - /* fetch_free(t->owner); */ + fetch_free(t->owner); /* t = t->next; */ t = head; continue; @@ -429,7 +432,7 @@ void poll_fetch(lwc_string *scheme) { struct httpfetcher *tnext = t->next; remove_from_poll(t->handle); fetch_remove_from_queues(t->owner); - /* fetch_free(t->owner); */ + fetch_free(t->owner); t = head; /* t = tnext; */ continue; -- cgit v1.2.3