From d25508e3a148d2309b8137fa317b6cf87150b0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Thu, 24 Oct 2019 13:27:54 +0800 Subject: Initialise key_product otherwise other members might be freed because they might not necessary be NULLs. --- client.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.c b/client.c index aa14da0..d06084c 100644 --- a/client.c +++ b/client.c @@ -64,6 +64,9 @@ void icclient_order(icclient_ord_order **orderptr, const char *sku icclient_product *key_product = malloc(sizeof(icclient_product)); key_product->sku = malloc(strlen(sku) + 1); strcpy(key_product->sku, sku); + key_product->description = NULL; + key_product->comment = NULL; + key_product->image = NULL; icclient_product *product = *(icclient_product **)bsearch(&key_product , products, catalog->length, sizeof(icclient_product *) , prodcmp); -- cgit v1.2.3