diff options
author | Mole Shang <[email protected]> | 2023-08-07 20:25:10 +0800 |
---|---|---|
committer | Mole Shang <[email protected]> | 2023-08-07 20:47:23 +0800 |
commit | 930e47faebd878fe29cfabe80286189f9113a58b (patch) | |
tree | f08689ccb68b7a5cc9fee06b09277cb66442855a /src/process_url.c | |
parent | 9c2a42246a7d391a0b6691faf4c9037689f2e94c (diff) | |
download | hinata-930e47faebd878fe29cfabe80286189f9113a58b.tar.gz hinata-930e47faebd878fe29cfabe80286189f9113a58b.tar.bz2 hinata-930e47faebd878fe29cfabe80286189f9113a58b.zip |
process_url: free malloc'd data
Diffstat (limited to 'src/process_url.c')
-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; } |