From 113269d00c6e76725a69d354c9c0359eaf032eb1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 9 Sep 2012 20:38:14 +0530 Subject: [PATCH] Another leak? --- src/calibre/utils/windows/winutil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/windows/winutil.c b/src/calibre/utils/windows/winutil.c index 0134bf21ed..c00bcc4b41 100644 --- a/src/calibre/utils/windows/winutil.c +++ b/src/calibre/utils/windows/winutil.c @@ -196,7 +196,8 @@ get_registry_property(HDEVINFO hDevInfo, DWORD index, DWORD property, BOOL *iter buffersize, &buffersize)) { if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - buffer = (LPTSTR)PyMem_Malloc(2*buffersize); // Twice for bug in Win2k + if (buffer != NULL) { PyMem_Free(buffer); buffer = NULL; } + buffer = (LPWSTR)PyMem_Malloc(2*buffersize); // Twice for bug in Win2k } else { PyMem_Free(buffer); PyErr_SetFromWindowsErr(0);