< prev index next >

src/jdk.security.auth/unix/native/libjaas/Unix.c

Print this page
rev 50999 : 8207233: Minor improvements of jdk C-coding

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -62,10 +62,13 @@
     jsize numSuppGroups;
     gid_t *groups;
     jclass cls;
 
     numSuppGroups = getgroups(0, NULL);
+    if (numSuppGroups == -1) {
+        return;
+    }
     groups = (gid_t *)calloc(numSuppGroups, sizeof(gid_t));
     if (groups == NULL) {
         jclass cls = (*env)->FindClass(env,"java/lang/OutOfMemoryError");
         if (cls != NULL)
             (*env)->ThrowNew(env, cls, NULL);
< prev index next >