winspool: Fix a leak in DocumentPropertiesA (valgrind)
Bruno Jesus
00cpxxx at gmail.com
Sat Jun 28 07:21:19 CDT 2014
Memory will be allocated if device name is Null or empty [1], but will
only be freed if Null.
Fixes bug https://bugs.winehq.org/show_bug.cgi?id=36810
[1] https://source.winehq.org/source/dlls/winspool.drv/info.c#L2372
-------------- next part --------------
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index bfb22cb..e755c39 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -2385,13 +2385,15 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
(LPCSTR)102 );
if (!GDI_CallExtDeviceMode16) {
ERR("No CallExtDeviceMode16?\n");
- return -1;
+ ret = -1;
+ goto end;
}
}
ret = GDI_CallExtDeviceMode16(hWnd, pDevModeOutput, lpName, port,
pDevModeInput, NULL, fMode);
- if(!pDeviceName)
+end:
+ if(!pDeviceName || !*pDeviceName)
HeapFree(GetProcessHeap(),0,lpName);
return ret;
}
More information about the wine-patches
mailing list