Windows NetHackW memory leak bit
This commit is contained in:
@@ -252,6 +252,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void free_menu_data(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
free_winmain_stuff(void)
|
free_winmain_stuff(void)
|
||||||
{
|
{
|
||||||
@@ -271,6 +273,7 @@ free_winmain_stuff(void)
|
|||||||
windowdata[cnt].address = 0;
|
windowdata[cnt].address = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free_menu_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ static TCHAR szMainWindowClass[] = TEXT("MSNHMainWndClass");
|
|||||||
static TCHAR szTitle[MAX_LOADSTRING];
|
static TCHAR szTitle[MAX_LOADSTRING];
|
||||||
struct window_tracking_data windowdata[MAXWINDOWS];
|
struct window_tracking_data windowdata[MAXWINDOWS];
|
||||||
extern void mswin_display_splash_window(BOOL);
|
extern void mswin_display_splash_window(BOOL);
|
||||||
|
extern void free_menu_data(void); /* mhmenu.c */
|
||||||
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||||
static LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
static LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ static void SelectMenuItem(HWND hwndList, PNHMenuWindow data, int item,
|
|||||||
int count);
|
int count);
|
||||||
static void reset_menu_count(HWND hwndList, PNHMenuWindow data);
|
static void reset_menu_count(HWND hwndList, PNHMenuWindow data);
|
||||||
static BOOL onListChar(HWND hWnd, HWND hwndList, WORD ch);
|
static BOOL onListChar(HWND hWnd, HWND hwndList, WORD ch);
|
||||||
|
static genericptr_t menu_data_to_free;
|
||||||
|
void free_menu_data(void);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
HWND
|
HWND
|
||||||
@@ -627,6 +629,8 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
data->menui.menu.items, data->menui.menu.allocated * sizeof(NHMenuItem));
|
data->menui.menu.items, data->menui.menu.allocated * sizeof(NHMenuItem));
|
||||||
if (!data->menui.menu.items)
|
if (!data->menui.menu.items)
|
||||||
free(was);
|
free(was);
|
||||||
|
else
|
||||||
|
menu_data_to_free = (genericptr_t) data->menui.menu.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->menui.menu.items) {
|
if (data->menui.menu.items) {
|
||||||
@@ -719,6 +723,14 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_menu_data(void)
|
||||||
|
{
|
||||||
|
if (menu_data_to_free != 0)
|
||||||
|
free(menu_data_to_free), menu_data_to_free = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
LayoutMenu(HWND hWnd)
|
LayoutMenu(HWND hWnd)
|
||||||
|
|||||||
Reference in New Issue
Block a user