Adding a bunch of memset's to menu/automap creations so we won't run into uninitialized variables
This commit is contained in:
parent
408f2ffd33
commit
fc6d51e19e
|
@ -4,6 +4,7 @@ D1X-Rebirth Changelog
|
|||
--------
|
||||
main/newmenu.c: Fix memory errors, but still dynamically allocate menu and lb so it doesn't have to stay in newmenu_do4 and newmenu_listbox1 respectively
|
||||
main/automap.c, main/game.c, main/game.h, main/multi.c, main/multi.h, main/net_ipx.c, main/net_udp.c, main/newmenu.c: Fix crashing when doing menus in multiplayer, don't let player move when in automap
|
||||
main/automap.c, main/kconfig.c, main/newmenu.c: Adding a bunch of memset's to menu/automap creations so we won't run into uninitialized variables
|
||||
|
||||
20100130
|
||||
--------
|
||||
|
|
|
@ -561,8 +561,12 @@ void do_automap( int key_code )
|
|||
automap *am;
|
||||
|
||||
MALLOC(am, automap, 1);
|
||||
|
||||
if (am)
|
||||
{
|
||||
memset(am, 0, sizeof(automap));
|
||||
automap_wind = window_create(&grd_curscreen->sc_canvas, 0, 0, SWIDTH, SHEIGHT, (int (*)(window *, d_event *, void *)) automap_handler, am);
|
||||
}
|
||||
|
||||
if (automap_wind == NULL)
|
||||
{
|
||||
|
|
|
@ -963,9 +963,11 @@ void kconfig_sub(kc_item * items,int nitems, char *title)
|
|||
kc_menu *menu;
|
||||
|
||||
MALLOC(menu, kc_menu, 1);
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
memset(menu, 0, sizeof(kc_menu));
|
||||
menu->time_stopped = 0;
|
||||
menu->items = items;
|
||||
menu->nitems = nitems;
|
||||
|
|
|
@ -1277,9 +1277,11 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
|
|||
int done = 0;
|
||||
|
||||
MALLOC(menu, newmenu, 1);
|
||||
|
||||
if (!menu)
|
||||
return -1;
|
||||
|
||||
memset(menu, 0, sizeof(newmenu));
|
||||
menu->scroll_offset = 0;
|
||||
menu->last_scroll_check = -1;
|
||||
menu->all_text = 0;
|
||||
|
@ -1972,9 +1974,11 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_
|
|||
int done = 0;
|
||||
|
||||
MALLOC(lb, listbox, 1);
|
||||
|
||||
if (!lb)
|
||||
return -1;
|
||||
|
||||
memset(lb, 0, sizeof(listbox));
|
||||
newmenu_close();
|
||||
|
||||
lb->title = title;
|
||||
|
|
Loading…
Reference in a new issue