[PATCH] winspool.drv: Check return value of EnumPrintersA
Marcus Meissner
marcus at jet.franken.de
Sat Jan 31 04:09:42 CST 2009
Hi,
Otherwise needed is in a undefined state.
Ciao, Marcus
---
dlls/winspool.drv/info.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 6212cc8..02e7568 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -1523,8 +1523,7 @@ void WINSPOOL_LoadSystemPrinters(void)
printers AddPrinter takes a while. So we'll tag all printers that
were automatically added last time around, if they still exist
we'll leave them be otherwise we'll delete them. */
- EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, NULL, 0, &needed, &num);
- if(needed) {
+ if (EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, NULL, 0, &needed, &num) && needed) {
PRINTER_INFO_5A* pi = HeapAlloc(GetProcessHeap(), 0, needed);
if(EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, (LPBYTE)pi, needed, &needed, &num)) {
for(i = 0; i < num; i++) {
--
1.5.6
More information about the wine-patches
mailing list