From 1c3653b26600f9d8f5317bb45b24ea49e4f862a3 Mon Sep 17 00:00:00 2001 From: psadhukhan Date: Tue, 21 Aug 2018 11:43:03 +0530 Subject: 8205356: Choose printer defaults Reviewed-by: prr, mschoene, rhalade --- src/windows/native/sun/windows/WPrinterJob.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/windows') diff --git a/src/windows/native/sun/windows/WPrinterJob.cpp b/src/windows/native/sun/windows/WPrinterJob.cpp index 3761c60dd1..70aaa74236 100644 --- a/src/windows/native/sun/windows/WPrinterJob.cpp +++ b/src/windows/native/sun/windows/WPrinterJob.cpp @@ -886,10 +886,12 @@ Java_sun_print_Win32PrintService_getDefaultSettings(JNIEnv *env, 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 } -- cgit v1.2.3