Add checks for null pointer / failed malloc to menu code
This commit is contained in:
@@ -120,6 +120,10 @@ menu_add_item_func(Client *c, int argc, char **argv)
|
||||
/* We need to create it */
|
||||
report(RPT_INFO, "Client [%d] is using the menu", c->sock);
|
||||
c->menu = menu_create("_client_menu_", menu_commands_handler, c->name, c);
|
||||
if (c->menu == NULL) {
|
||||
sock_send_error(c->sock, "Cannot create menu\n");
|
||||
return 1;
|
||||
}
|
||||
menu_add_item(main_menu, c->menu);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user