8205360: Choose printer defaults
authorpsadhukhan
Tue, 31 Jul 2018 11:43:24 +0530
changeset 53314 827db73f2d6a
parent 53313 c66b192fe3b4
child 53315 3d4e47348142
8205360: Choose printer defaults Reviewed-by: prr, mschoene, rhalade
src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp
--- a/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp	Thu Jul 19 15:23:06 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp	Tue Jul 31 11:43:24 2018 +0530
@@ -962,9 +962,10 @@
               if (!present) {
                   defIndices[0] = papers[0];
               }
-              if (papers != NULL) {
-                  free((char*)papers);
-              }
+          }
+          // If DeviceCapabilities fails, then also free paper allocation
+          if (papers != NULL) {
+              free((char*)papers);
           }
       }
       RESTORE_CONTROLWORD