From b29d74f4f9ae28518b05210ce8411b9774562d7c Mon Sep 17 00:00:00 2001 From: gerbert Date: Thu, 12 Jan 2023 11:07:31 +0200 Subject: [PATCH] Optimize free() call --- src/callbacks.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index d000d68..fcbb237 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -161,6 +161,8 @@ void convert(void *value) { break; } + free(ptr); + if (ret <= UINT32_MAX) { switch (mode) { case MODE_DEC_HEX: @@ -197,12 +199,9 @@ void convert(void *value) { printf("Error: Integer overflow"); } - if (os_GetKey() == k_Quit) { - free(ptr); + if (os_GetKey() == k_Quit) return; - } - free(ptr); // Return back convert(value); }