summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-20 08:48:39 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-20 08:48:39 +0800
commite536eb906b16fb408d9480b55fd4d91d2f73c0b4 (patch)
treeb67816ad2f6c6e1b6902ba96e8ef38baaf73b0ca
parent54d9e73d76270fe6e635a71db2dc1476d1be99ff (diff)
Initialise ticket list earlier
-rw-r--r--ticket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ticket.c b/ticket.c
index 1c96e4c..bffab9b 100644
--- a/ticket.c
+++ b/ticket.c
@@ -51,7 +51,6 @@ static size_t search_callback(void *contents, size_t size, size_t nmemb
char *line = strtok(response, "\n");
if (strstr(line, "200 Ok")) {
- (*listptr)->length = 0;
line = strtok(NULL, "\n");
do {
(*listptr)->length++;
@@ -95,6 +94,8 @@ static size_t search_callback(void *contents, size_t size, size_t nmemb
void rtclient_ticket_search(rtclient_ticketlist **listptr, const char *query)
{
*listptr = malloc(sizeof(rtclient_ticketlist));
+ rtclient_ticketlist *list = *listptr;
+ list->length = 0;
request(search_callback, (void *)listptr, NULL, "%s%s"
, "/REST/1.0/search/ticket?query=", query);
}