From c22d413110659b6cf1d080e0afa9afdac3948170 Mon Sep 17 00:00:00 2001 From: Leonardo Alminana Date: Thu, 9 Feb 2023 16:13:03 +0100 Subject: [PATCH] id: fixed a potential leak when a malformed string is processed Signed-off-by: Leonardo Alminana --- src/ctr_id.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ctr_id.c b/src/ctr_id.c index e91a894..0c2299f 100644 --- a/src/ctr_id.c +++ b/src/ctr_id.c @@ -242,11 +242,12 @@ struct ctrace_id *ctr_id_from_base16(cfl_sds_t id) input_index++; } - if (!result) { - return NULL; + if (result) { + result_id = ctr_id_create(decoded_id, length / 2); + } + else { + result_id = NULL; } - - result_id = ctr_id_create(decoded_id, length / 2); cfl_sds_destroy(decoded_id);