From 84207f6e0a54bdb8fb263ba4e0a90417e6352892 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:56 +0800 Subject: Ticket history data member might be empty --- ticket.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ticket.c b/ticket.c index 4960969..821f982 100644 --- a/ticket.c +++ b/ticket.c @@ -145,9 +145,13 @@ static size_t history_handler(void *contents, size_t size, size_t nmemb ticket_history->new_value = NULL; } else if (!strcmp(token, "Data")) { token = strtok_r(NULL, ":", &tokensaveptr); - ticket_history->data - = malloc(strlen(token)); - strcpy(ticket_history->data, ++token); + if (token && strcmp(token, "")) { + ticket_history->data + = malloc(strlen(token)); + strcpy(ticket_history->data + , ++token); + } else + ticket_history->data = NULL; } else if (!strcmp(token, "Description")) { token = strtok_r(NULL, ":", &tokensaveptr); ticket_history->description -- cgit v1.2.3