summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--anteraja.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/anteraja.c b/anteraja.c
index aad6d04..ad194f5 100644
--- a/anteraja.c
+++ b/anteraja.c
@@ -108,8 +108,10 @@ void anteraja_order(const char *trx_id, const char *service, const char *sender_
atoi(items[i][PRICE]), atoi(items[i][WEIGHT]) * 1000);
if (json)
json = realloc(json, strlen(json) + length);
- else
+ else {
json = malloc(length);
+ memset(json, '\0', strlen(json));
+ }
strcat(json, item);
if (i + 1 < nitems)
json[length] = ',';