summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-24 13:27:54 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-24 13:27:54 +0800
commitd25508e3a148d2309b8137fa317b6cf87150b0bd (patch)
tree2238e3c02dc01b4e48bde23b0292a98ef56d14d4
parent0bef9b7717ecff9544284f5ba4b7576dadad4892 (diff)
Initialise key_product
otherwise other members might be freed because they might not necessary be NULLs.
-rw-r--r--client.c3
1 files changed, 3 insertions, 0 deletions
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);