Fix incorrect handling of malloc failures

PR:		bin/83369
MFC after:	1 week
This commit is contained in:
Matteo Riondato 2008-02-04 07:56:36 +00:00
parent b42024b241
commit c75cd2cb75
2 changed files with 8 additions and 2 deletions

View File

@ -29,6 +29,8 @@ SRCS+= ${GENSRCS} ${OTHERSRCS} ${SECRPCSRCS}
CLEANFILES+= ${GENSRCS}
WARNS?= 2
.include <bsd.lib.mk>
.SUFFIXES: .x _xdr.c

View File

@ -67,7 +67,9 @@ xencrypt(secret, passwd)
int len;
len = strlen(secret) / 2;
buf = malloc((unsigned)len);
if ((buf = malloc((unsigned)len)) == NULL) {
return(0);
}
hex2bin(len, secret, buf);
passwd2des(passwd, key);
@ -100,7 +102,9 @@ xdecrypt(secret, passwd)
int len;
len = strlen(secret) / 2;
buf = malloc((unsigned)len);
if ((buf = malloc((unsigned)len)) == NULL) {
return(0);
}
hex2bin(len, secret, buf);
passwd2des(passwd, key);