With the current code 'src' is never NULL. Nevertheless move the check for

NULL before dereferencing the pointer.

Found with:	Coverity Prevent(tm)
CID:		2528
This commit is contained in:
Bjoern A. Zeeb 2007-06-15 22:35:59 +00:00
parent 0061e03d7f
commit 91c7ac6740
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170799

View File

@ -7296,11 +7296,13 @@ key_setkey(struct seckey *src, u_int16_t exttype)
{
struct mbuf *m;
struct sadb_key *p;
int len = PFKEY_ALIGN8(sizeof(struct sadb_key) + _KEYLEN(src));
int len;
if (src == NULL)
return NULL;
len = PFKEY_ALIGN8(sizeof(struct sadb_key) + _KEYLEN(src));
m = key_alloc_mbuf(len);
if (m == NULL)
return NULL;