From dde92f8ffa5d0eb6038c6e8009bf79120b7b23d2 Mon Sep 17 00:00:00 2001 From: Joachim Henze Date: Mon, 31 Aug 2020 02:06:35 +0200 Subject: [PATCH] [WINSPOOL] Properly fix a double free CORE-16715 Addendum to 0.4.14-dev-957-g d90beaeed26863985486874aaa2a1c3422fd6d9f Many Thanks to the patches author Doug Lyons! --- win32ss/printing/base/winspool/printers.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/win32ss/printing/base/winspool/printers.c b/win32ss/printing/base/winspool/printers.c index 1c39d7ae009..dfff8223a87 100644 --- a/win32ss/printing/base/winspool/printers.c +++ b/win32ss/printing/base/winspool/printers.c @@ -668,7 +668,7 @@ DocumentPropertiesA(HWND hWnd, HANDLE hPrinter, LPSTR pDeviceName, PDEVMODEA pDe PWSTR pwszDeviceName = NULL; PDEVMODEW pdmwInput = NULL; PDEVMODEW pdmwOutput = NULL; - BOOL bReturnValue = -1; + LONG lReturnValue = -1; DWORD cch; FIXME("DocumentPropertiesA(%p, %p, %s, %p, %p, %lu)\n", hWnd, hPrinter, pDeviceName, pDevModeOutput, pDevModeInput, fMode); @@ -716,15 +716,10 @@ DocumentPropertiesA(HWND hWnd, HANDLE hPrinter, LPSTR pDeviceName, PDEVMODEA pDe } } - bReturnValue = DocumentPropertiesW(hWnd, hPrinter, pwszDeviceName, pdmwOutput, pdmwInput, fMode); - FIXME("bReturnValue from DocumentPropertiesW is '%ld'.\n", bReturnValue); + lReturnValue = DocumentPropertiesW(hWnd, hPrinter, pwszDeviceName, pdmwOutput, pdmwInput, fMode); + FIXME("lReturnValue from DocumentPropertiesW is '%ld'.\n", lReturnValue); - if (pwszDeviceName) - { - HeapFree(hProcessHeap, 0, pwszDeviceName); - } - - if (bReturnValue < 0) + if (lReturnValue < 0) { FIXME("DocumentPropertiesW failed!\n"); goto Cleanup; @@ -745,7 +740,7 @@ Cleanup: if (pdmwOutput) HeapFree(hProcessHeap, 0, pdmwOutput); - return bReturnValue; + return lReturnValue; } PRINTER_INFO_9W * get_devmodeW(HANDLE hprn)