summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-01 20:51:21 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-01 20:51:21 +0800
commit9c87e89acc77f59f5a110c6216fc9cab62011ff5 (patch)
treef756b5dd8efc54cfdf93bce776e11d5296fad804
parenta589075c75ace73cd21e0c0ee32e31df3f6a5389 (diff)
Initialise ticket history members with NULL
if there's no string data
-rw-r--r--ticket.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ticket.c b/ticket.c
index fc8feb1..4960969 100644
--- a/ticket.c
+++ b/ticket.c
@@ -132,7 +132,8 @@ static size_t history_handler(void *contents, size_t size, size_t nmemb
= malloc(strlen(token));
strcpy(ticket_history->old_value
, ++token);
- }
+ } else
+ ticket_history->old_value = NULL;
} else if (!strcmp(token, "NewValue")) {
token = strtok_r(NULL, ":", &tokensaveptr);
if (token && strcmp(token, "")) {
@@ -140,7 +141,8 @@ static size_t history_handler(void *contents, size_t size, size_t nmemb
= malloc(strlen(token));
strcpy(ticket_history->new_value
, ++token);
- }
+ } else
+ ticket_history->new_value = NULL;
} else if (!strcmp(token, "Data")) {
token = strtok_r(NULL, ":", &tokensaveptr);
ticket_history->data
@@ -210,6 +212,7 @@ static size_t history_handler(void *contents, size_t size, size_t nmemb
= atoi(token);
} else if (!strcmp(token, "Attachments")) {
token = strtok_r(NULL, ":", &tokensaveptr);
+ ticket_history->attachments = NULL;
break;
}
} while ((line = strtok_r(NULL, "\n", &linesaveptr)));