Skip to content

Commit

Permalink
free http get response after done with it. (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
diasbruno committed Aug 29, 2023
1 parent 0565c3d commit 182e8a8
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/clib-search.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,16 @@ static char *wiki_html_cache() {

debug(&debugger, "setting cache from %s", CLIB_WIKI_URL);
http_get_response_t *res = http_get(CLIB_WIKI_URL);
if (!res->ok)
return NULL;

char *html = strdup(res->data);
if (NULL == html)
return NULL;
char *html = NULL;

if (res->ok && (html = strdup(res->data)) != NULL) {
clib_cache_save_search(html);
debug(&debugger, "wrote cach");
}

http_get_free(res);

if (NULL == html)
return html;
clib_cache_save_search(html);
debug(&debugger, "wrote cach");
return html;
}

Expand Down

0 comments on commit 182e8a8

Please sign in to comment.