If malloc allocation fails, the menu_item pointer cannot be executed, because when the strncpy function is executed, there will be a problem with the null pointer. Adding an if statement should ensure that the allocation fails and will not be executed. thanks.