Merge pull request #3927 from DavBfr/fix-win-printer

Bugfix: wrong test regarding the first GetPrinter
This commit is contained in:
Bernhard Miklautz 2017-04-27 08:55:39 +02:00 committed by GitHub
commit 97dd6fb9b1

View File

@ -184,7 +184,7 @@ static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver,
const WCHAR* name, const WCHAR* drivername, BOOL is_default)
{
rdpWinPrinter* win_printer;
DWORD needed;
DWORD needed = 0;
int status;
PRINTER_INFO_2 *prninfo=NULL;
@ -217,7 +217,9 @@ static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver,
return NULL;
}
if (!GetPrinter(win_printer->hPrinter, 2, (LPBYTE) prninfo, 0, &needed))
/* How many memory should be allocated for printer data */
GetPrinter(win_printer->hPrinter, 2, (LPBYTE) prninfo, 0, &needed);
if (needed == 0)
{
free(win_printer->printer.name);
free(win_printer);