jdk/src/solaris/native/sun/awt/awt_Robot.c
changeset 24130 db72fc72f87b
parent 23010 6dadb192ad81
--- a/jdk/src/solaris/native/sun/awt/awt_Robot.c	Mon Mar 24 23:02:05 2014 +0400
+++ b/jdk/src/solaris/native/sun/awt/awt_Robot.c	Tue Mar 25 16:31:02 2014 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -175,10 +175,13 @@
 
     num_buttons = numberOfButtons;
     tmp = (*env)->GetIntArrayElements(env, buttonDownMasks, JNI_FALSE);
+    CHECK_NULL(tmp);
+
     masks = (jint *)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), num_buttons);
     if (masks == (jint *) NULL) {
+        (*env)->ExceptionClear(env);
+        (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
         JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
-        (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
         return;
     }
     for (i = 0; i < num_buttons; i++) {