From d63004317fa73c1a9cf25958c42b73d4b16f16b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sat, 24 Jul 2021 17:26:52 +0800 Subject: Make sure the slot is nulled --- pikul.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pikul.c b/pikul.c index c9d9eda..c967c90 100644 --- a/pikul.c +++ b/pikul.c @@ -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(); } -- cgit v1.2.3