From 1c6462e9fd157384d614ba9ce9dc24b6202c1197 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: Wed, 2 Oct 2019 18:44:43 +0800 Subject: Fix ticket history member freeing --- ticket.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ticket.c b/ticket.c index 7440693..d900354 100644 --- a/ticket.c +++ b/ticket.c @@ -346,16 +346,14 @@ void rtclient_ticket_history(rtclient_ticket_history_list **listptr void rtclient_ticket_history_free(struct rtclient_ticket_history *history) { - if (history->attachments->length) { - for (size_t i = 0; i < history->attachments->length; i++) { - rtclient_ticket_history_attachment *attachment - = history->attachments->attachments[i]; - if (attachment->file_name) - free(attachment->file_name); - free(attachment); - } - free(history->attachments); + for (size_t i = 0; i < history->attachments->length; i++) { + rtclient_ticket_history_attachment *attachment + = history->attachments->attachments[i]; + if (attachment->file_name) + free(attachment->file_name); + free(attachment); } + free(history->attachments); free(history->created); free(history->creator); free(history->content); @@ -366,6 +364,8 @@ void rtclient_ticket_history_free(struct rtclient_ticket_history *history) free(history->new_value); if (history->old_value) free(history->old_value); + if (history->field) + free(history->field); free(history); history = NULL; } -- cgit v1.2.3