< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp

Print this page
rev 15133 : 8161923: Fix two memory issues.
Reviewed-by: vadim


1115         return FALSE;
1116     }
1117 
1118     *pDevMode = (LPDEVMODE)GlobalAlloc(GPTR, dwNeeded);
1119 
1120     if (*pDevMode == NULL) {
1121         return FALSE;
1122     }
1123 
1124     DWORD dwRet = ::DocumentProperties(NULL,
1125                                        hPrinter,
1126                                        printerName,
1127                                        *pDevMode,
1128                                        NULL,
1129                                        DM_OUT_BUFFER);
1130 
1131     RESTORE_CONTROLWORD
1132 
1133     if (dwRet != IDOK)  {
1134         /* if failure, cleanup and return failure */
1135         GlobalFree(pDevMode);
1136         *pDevMode = NULL;
1137         return FALSE;
1138     }
1139 
1140     return TRUE;
1141 }


1115         return FALSE;
1116     }
1117 
1118     *pDevMode = (LPDEVMODE)GlobalAlloc(GPTR, dwNeeded);
1119 
1120     if (*pDevMode == NULL) {
1121         return FALSE;
1122     }
1123 
1124     DWORD dwRet = ::DocumentProperties(NULL,
1125                                        hPrinter,
1126                                        printerName,
1127                                        *pDevMode,
1128                                        NULL,
1129                                        DM_OUT_BUFFER);
1130 
1131     RESTORE_CONTROLWORD
1132 
1133     if (dwRet != IDOK)  {
1134         /* if failure, cleanup and return failure */
1135         GlobalFree(*pDevMode);
1136         *pDevMode = NULL;
1137         return FALSE;
1138     }
1139 
1140     return TRUE;
1141 }
< prev index next >