changeset 10083:7790a9e0f168

8036613: [parfait] JNI exception pending in jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c Reviewed-by: mullan
author vinnie
date Mon, 16 Jun 2014 13:40:49 +0100
parents 38f576159c1a
children b2023f11a0e5
files src/windows/native/sun/security/provider/WinCAPISeedGenerator.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c	Mon Jun 16 13:52:25 2014 +0200
+++ b/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c	Mon Jun 16 13:40:49 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -59,11 +59,16 @@
 
     numBytes = (*env)->GetArrayLength(env, randArray);
     randBytes = (*env)->GetByteArrayElements(env, randArray, NULL);
+    if (randBytes == NULL) {
+        goto cleanup;
+    }
+
     if (CryptGenRandom(hCryptProv, numBytes, randBytes)) {
         result = JNI_TRUE;
     }
     (*env)->ReleaseByteArrayElements(env, randArray, randBytes, 0);
 
+cleanup:
     CryptReleaseContext(hCryptProv, 0);
 
     return result;