diff --git a/http_intf.c b/http_intf.c index ea6b6a96fb..1678edb608 100644 --- a/http_intf.c +++ b/http_intf.c @@ -78,12 +78,16 @@ bool http_download_file(char *url, const char *output_dir, f = fopen(output_path, "wb"); if (!f) - return false; + goto cleanup; fwrite(buf, 1, len, f); fclose(f); +cleanup: + if (buf) + free(buf); + return true; }