1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

nv_malloc can fail in userland.

Add check to prevent a NULL pointer dereference.

Pointed out by:	mjg
Approved by:	pjd (mentor)
This commit is contained in:
Mariusz Zaborski 2015-05-02 18:12:34 +00:00
parent da20d06f84
commit a523fa069f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282350

View File

@ -129,6 +129,8 @@ nvlist_create(int flags)
PJDLOG_ASSERT((flags & ~(NV_FLAG_PUBLIC_MASK)) == 0);
nvl = nv_malloc(sizeof(*nvl));
if (nvl == NULL)
return (NULL);
nvl->nvl_error = 0;
nvl->nvl_flags = flags;
nvl->nvl_parent = NULL;