From 3d6c65ba25253e0876f6140ed0ab5e0a8e94dee7 Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Thu, 25 May 2023 01:22:54 +0200 Subject: [PATCH] tik: fix memory leak. --- source/core/tik.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/core/tik.c b/source/core/tik.c index 2cce0aa..a77c773 100644 --- a/source/core/tik.c +++ b/source/core/tik.c @@ -231,7 +231,13 @@ bool tikConvertPersonalizedTicketToCommonTicket(Ticket *tik, u8 **out_raw_cert_c memset(tik->data + tik->size, 0, SIGNED_TIK_MAX_SIZE - tik->size); /* Update output pointers. */ - if (out_raw_cert_chain) *out_raw_cert_chain = raw_cert_chain; + if (out_raw_cert_chain) + { + *out_raw_cert_chain = raw_cert_chain; + } else { + free(raw_cert_chain); + } + if (out_raw_cert_chain_size) *out_raw_cert_chain_size = raw_cert_chain_size; return true;