Skip to content

Commit 52ed2aa

Browse files
committedJan 20, 2021
8259786: initialize last parameter of getpwuid_r
Reviewed-by: mdoerr, hseigel
1 parent 70b5b31 commit 52ed2aa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎src/hotspot/os/posix/perfMemory_posix.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static char* get_user_name(uid_t uid) {
461461

462462
char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
463463

464-
struct passwd* p;
464+
struct passwd* p = NULL;
465465
int result = getpwuid_r(uid, &pwent, pwbuf, (size_t)bufsize, &p);
466466

467467
if (result != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@ Java_com_sun_security_auth_module_UnixSystem_getUnixInfo
4545

4646
int i;
4747
char pwd_buf[1024];
48-
struct passwd *pwd;
48+
struct passwd *pwd = NULL;
4949
struct passwd resbuf;
5050
jfieldID userNameID;
5151
jfieldID userID;

0 commit comments

Comments
 (0)
Please sign in to comment.