Avoid possible null deref if ypclnt_new returns null
PR: bin/172979 Submitted by: Erik Cederstrand <erik@cederstrand.dk> Approved by: cperciva MFC after: 3 days
This commit is contained in:
parent
d207a5583c
commit
fd773ca3dd
@ -241,8 +241,11 @@ main(int argc, char *argv[])
|
||||
#ifdef YP
|
||||
case _PWF_NIS:
|
||||
ypclnt = ypclnt_new(yp_domain, "passwd.byname", yp_host);
|
||||
if (ypclnt == NULL ||
|
||||
ypclnt_connect(ypclnt) == -1 ||
|
||||
if (ypclnt == NULL) {
|
||||
warnx("ypclnt_new failed");
|
||||
exit(1);
|
||||
}
|
||||
if (ypclnt_connect(ypclnt) == -1 ||
|
||||
ypclnt_passwd(ypclnt, pw, password) == -1) {
|
||||
warnx("%s", ypclnt->error);
|
||||
ypclnt_free(ypclnt);
|
||||
|
Loading…
Reference in New Issue
Block a user