Add checks for null pointer / failed malloc to menu code

This commit is contained in:
mmdolze
2009-06-06 14:48:48 +00:00
parent 490e5f212c
commit 8644e5a347
5 changed files with 120 additions and 38 deletions
+4
View File
@@ -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);
}