From 25c116e192cfc40c3e42a6f51b57f65f8cd69c7e Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 20 Nov 2017 18:46:07 -0500 Subject: [PATCH] Fix strdup() memory leak --- menu/widgets/menu_dialog.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/menu/widgets/menu_dialog.c b/menu/widgets/menu_dialog.c index 4e4ecb065b..30f645d824 100644 --- a/menu/widgets/menu_dialog.c +++ b/menu/widgets/menu_dialog.c @@ -263,8 +263,13 @@ void menu_dialog_push(void) info.list = menu_entries_get_menu_stack_ptr(0); info.enum_idx = MENU_ENUM_LABEL_HELP; - info.label = strdup( - msg_hash_to_str(MENU_ENUM_LABEL_HELP)); + + // Set the label string, if it exists. + const char *label = msg_hash_to_str(MENU_ENUM_LABEL_HELP); + if (label) + { + info.label = strdup(label); + } menu_displaylist_ctl(DISPLAYLIST_HELP, &info); }