From 9c87e89acc77f59f5a110c6216fc9cab62011ff5 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: Tue, 1 Oct 2019 20:51:21 +0800 Subject: Initialise ticket history members with NULL if there's no string data --- ticket.c | 7 +++++-- 1 file 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))); -- cgit v1.2.3