From 4bcc4790413e79bd500fb8905269c50c78248bdf Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Mon, 11 Jul 2022 19:14:48 +0200 Subject: [PATCH] Further refinement of function --- menu/menu_driver.c | 7 +++---- runtime_file.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index f7ac980690..c36e8497c8 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -650,12 +650,11 @@ static void strftime_am_pm(char *s, size_t len, const char* format, strftime(s, len, format, timeptr); #if !(defined(__linux__) && !defined(ANDROID)) local = local_to_utf8_string_alloc(s); - - if (!string_is_empty(local)) - strlcpy(s, local, len); - if (local) { + if (!string_is_empty(local)) + strlcpy(s, local, len); + free(local); local = NULL; } diff --git a/runtime_file.c b/runtime_file.c index 3580a689f2..0057d79f52 100644 --- a/runtime_file.c +++ b/runtime_file.c @@ -637,12 +637,11 @@ static void last_played_strftime(char *s, size_t len, const char *format, strftime(s, len, format, timeptr); #if !(defined(__linux__) && !defined(ANDROID)) local = local_to_utf8_string_alloc(s); - - if (!string_is_empty(local)) - strlcpy(s, local, len); - if (local) { + if (!string_is_empty(local)) + strlcpy(s, local, len); + free(local); local = NULL; }