Fix strdup() memory leak

This commit is contained in:
Rob Loach 2017-11-20 18:46:07 -05:00
parent f27574b807
commit 25c116e192
No known key found for this signature in database
GPG Key ID: 627C60834A74A21A

View File

@ -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);
}