Windows: free more allocated memory before exit

This gets rid of the final leak complaint on Windows as of Nov 13, 2024
This commit is contained in:
nhmall
2024-11-13 13:48:50 -05:00
parent c85b5d3e56
commit fa9210aa65
11 changed files with 57 additions and 15 deletions
+3
View File
@@ -83,8 +83,10 @@ NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
data = (PNHTextWindow)malloc(sizeof(NHTextWindow));
if (!data)
panic("out of memory");
ZeroMemory(data, sizeof(NHTextWindow));
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
windowdata[NHW_TEXT].address = (genericptr_t) data; // for cleanup at the end
HWND control = GetDlgItem(hWnd, IDC_TEXT_CONTROL);
HDC hdc = GetDC(control);
@@ -173,6 +175,7 @@ NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
free(data->window_text);
free(data);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) 0);
windowdata[NHW_TEXT].address = 0;
}
break;