diff options
-rw-r--r-- | src/process_url.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/process_url.c b/src/process_url.c index bba3c53..b6fa730 100644 --- a/src/process_url.c +++ b/src/process_url.c @@ -20,8 +20,8 @@ #include "extractors/extractor.h" #include "logger.h" #include "process_url.h" -#include "utils/utils.h" #include "utils/types.h" +#include "utils/utils.h" /* NOTICE: the global curl_conf pointer will only stay valid during downloading, * otherwise, ALWAYS point it to NULL. */ @@ -497,12 +497,12 @@ void poll_status(status_t *stat) { thrd_join(tid[i], &r); } merge_and_cleanup(curl_conf); + append_log("Download %s finished.\n", curl_conf->outfn); // Perform the callback if (is_empty_queue(&dl_queue) && callback_g) { callback_g(p_callback_struct_g); } - append_log("Download %s finished.\n", curl_conf->outfn); - curl_conf = NULL; + free_and_nullify(curl_conf); } mtx_unlock(&mtx); } @@ -520,6 +520,7 @@ int get(const char *URL, char **pdstr) { CURLcode res = logerr(curl_easy_perform(curl)); *pdstr = malloc(pagedata.len + 1); strcpy(*pdstr, pagedata.string); + free_and_nullify(pagedata.string); curl_easy_cleanup(curl); return res; } |