8214380: AwtDragSource function LoadCache misses a ReleaseLongArrayElements in special case
Reviewed-by: serb, stuefe
--- a/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp Tue Dec 04 13:35:04 2018 +0530
+++ b/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp Fri Nov 30 13:31:31 2018 +0100
@@ -394,9 +394,12 @@
return;
}
- jboolean isCopy;
- jlong *lFormats = env->GetLongArrayElements(formats, &isCopy),
+ jlong *lFormats = env->GetLongArrayElements(formats, 0),
*saveFormats = lFormats;
+ if (lFormats == NULL) {
+ m_ntypes = 0;
+ return;
+ }
for (i = 0, m_ntypes = 0; i < items; i++, lFormats++) {
// Warning C4244.
@@ -422,6 +425,7 @@
m_types = (FORMATETC *)safe_Calloc(sizeof(FORMATETC), m_ntypes);
} catch (std::bad_alloc&) {
m_ntypes = 0;
+ env->ReleaseLongArrayElements(formats, saveFormats, 0);
throw;
}