mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 22:12:47 -05:00
Make memory management uniform: _everything_ now goes through the
smalloc() macros and thence to the safemalloc() functions in misc.c. This should allow me to plug in a debugging allocator and track memory leaks and segfaults and things. [originally from svn r818]
This commit is contained in:
9
window.c
9
window.c
@ -413,9 +413,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
|
||||
{
|
||||
char *bits;
|
||||
int size = (font_width+15)/16 * 2 * font_height;
|
||||
bits = calloc(size, 1);
|
||||
bits = smalloc(size);
|
||||
memset(bits, 0, size);
|
||||
caretbm = CreateBitmap(font_width, font_height, 1, 1, bits);
|
||||
free(bits);
|
||||
sfree(bits);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1130,7 +1131,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
||||
cl = c;
|
||||
} else if (wParam == IDM_SAVEDSESS) {
|
||||
char *session = sessions[(lParam - IDM_SAVED_MIN) / 16];
|
||||
cl = malloc(16 + strlen(session)); /* 8, but play safe */
|
||||
cl = smalloc(16 + strlen(session)); /* 8, but play safe */
|
||||
if (!cl)
|
||||
cl = NULL; /* not a very important failure mode */
|
||||
else {
|
||||
@ -1154,7 +1155,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
||||
if (filemap)
|
||||
CloseHandle(filemap);
|
||||
if (freecl)
|
||||
free(cl);
|
||||
sfree(cl);
|
||||
}
|
||||
break;
|
||||
case IDM_RECONF:
|
||||
|
Reference in New Issue
Block a user