winspool: Fix potential string buffer leaks (Coverity).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-12-22 13:02:02 +03:00 committed by Alexandre Julliard
parent a3aad9d80f
commit 614ad0c8c2

View File

@ -8565,17 +8565,17 @@ LPSTR WINAPI StartDocDlgA( HANDLE hPrinter, DOCINFOA *doc )
if (doc->lpszDocName)
{
docnameW = asciitounicode(&usBuffer, doc->lpszDocName);
if (!(docW.lpszDocName = docnameW)) return NULL;
if (!(docW.lpszDocName = docnameW)) goto failed;
}
if (doc->lpszOutput)
{
outputW = asciitounicode(&usBuffer, doc->lpszOutput);
if (!(docW.lpszOutput = outputW)) return NULL;
if (!(docW.lpszOutput = outputW)) goto failed;
}
if (doc->lpszDatatype)
{
datatypeW = asciitounicode(&usBuffer, doc->lpszDatatype);
if (!(docW.lpszDatatype = datatypeW)) return NULL;
if (!(docW.lpszDatatype = datatypeW)) goto failed;
}
docW.fwType = doc->fwType;
@ -8589,6 +8589,7 @@ LPSTR WINAPI StartDocDlgA( HANDLE hPrinter, DOCINFOA *doc )
HeapFree(GetProcessHeap(), 0, retW);
}
failed:
HeapFree(GetProcessHeap(), 0, datatypeW);
HeapFree(GetProcessHeap(), 0, outputW);
HeapFree(GetProcessHeap(), 0, docnameW);