changeset 58492:401496a02949

8240518: Incorrect JNU_ReleaseStringPlatformChars in Windows Print Reviewed-by: serb, pbansal, psadhukhan
author tnakamura
date Mon, 09 Mar 2020 15:07:11 +0530
parents 7931313ece51
children c4d580d1305a
files src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp	Mon Mar 09 00:18:23 2020 +0300
+++ b/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp	Mon Mar 09 15:07:11 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -661,7 +661,7 @@
   }
 
   JNU_ReleaseStringPlatformChars(env, printer, printerName);
-  JNU_ReleaseStringPlatformChars(env, printer, printerPort);
+  JNU_ReleaseStringPlatformChars(env, port, printerPort);
   return resolutionArray;
 }
 
@@ -804,7 +804,7 @@
 
   RESTORE_CONTROLWORD
   JNU_ReleaseStringPlatformChars(env, printer, printerName);
-  JNU_ReleaseStringPlatformChars(env, printer, printerPort);
+  JNU_ReleaseStringPlatformChars(env, port, printerPort);
   return ret;
 }
 
--- a/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp	Mon Mar 09 00:18:23 2020 +0300
+++ b/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp	Mon Mar 09 15:07:11 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -696,6 +696,7 @@
             }
             ::GlobalUnlock(pd.hDevNames);
         }
+        JNU_ReleaseStringPlatformChars(env, printerName, getName);
 
         if (!samePrinter) {
             LPTSTR foundPrinter = NULL;