diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-24 17:26:52 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-24 17:26:52 +0800 |
commit | d63004317fa73c1a9cf25958c42b73d4b16f16b0 (patch) | |
tree | 349b69a9fd593162b31db6d1b7f1ef2ddc85dd7b | |
parent | b960919d909c75dc9c483846c2acec5315a0b7db (diff) |
Make sure the slot is nulled
-rw-r--r-- | pikul.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -320,7 +320,8 @@ char *pikul_order(enum pikul_company company, const char *order_number, const ch void pikul_cleanup() { for (enum pikul_company company = PIKUL; company < PIKUL_END; company++) { - if (!shipping_list[company]) + struct shipping *shipping = shipping_list[company]; + if (!shipping) continue; switch (company) { case PIKUL_ANTERAJA: @@ -329,11 +330,12 @@ void pikul_cleanup() default: break; } - struct shipping *shipping = shipping_list[company]; free(shipping->base); json_tokener_free(shipping->tokener); curl_slist_free_all(shipping->headers); curl_easy_cleanup(shipping->handle); + free(shipping); + shipping_list[company] = NULL; } curl_global_cleanup(); } |