Bruno Jesus : winspool: Fix a leak in DocumentPropertiesA (valgrind).
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jul 8 15:06:45 CDT 2014
Module: wine
Branch: master
Commit: daaa4c40d46e08e2bb3ab5ddb5889bdc6e782594
URL: http://source.winehq.org/git/wine.git/?a=commit;h=daaa4c40d46e08e2bb3ab5ddb5889bdc6e782594
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Mon Jul 7 21:12:25 2014 -0300
winspool: Fix a leak in DocumentPropertiesA (valgrind).
---
dlls/winspool.drv/info.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index bfb22cb..73323f8 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -2361,7 +2361,7 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
LPSTR pDeviceName, LPDEVMODEA pDevModeOutput,
LPDEVMODEA pDevModeInput,DWORD fMode )
{
- LPSTR lpName = pDeviceName;
+ LPSTR lpName = pDeviceName, dupname = NULL;
static CHAR port[] = "LPT1:";
LONG ret;
@@ -2376,7 +2376,7 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
SetLastError(ERROR_INVALID_HANDLE);
return -1;
}
- lpName = strdupWtoA(lpNameW);
+ lpName = dupname = strdupWtoA(lpNameW);
}
if (!GDI_CallExtDeviceMode16)
@@ -2385,14 +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)
- HeapFree(GetProcessHeap(),0,lpName);
+end:
+ HeapFree(GetProcessHeap(), 0, dupname);
return ret;
}
More information about the wine-cvs
mailing list