mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Fix nvlist array memory leak.
When we change nvl_array_next to NULL it means that we want to destroy or take nvlist_array. The nvpair, which stores next nvlist of nvlist_array element is no longer needed and can be freed. Submitted by: Adam Starak <starak.adam@gmail.com> MFC after: 1 week
This commit is contained in:
parent
26dc4fcaa7
commit
1b55032939
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302966
@ -236,10 +236,12 @@ nvlist_set_array_next(nvlist_t *nvl, nvpair_t *ele)
|
|||||||
|
|
||||||
NVLIST_ASSERT(nvl);
|
NVLIST_ASSERT(nvl);
|
||||||
|
|
||||||
if (ele != NULL)
|
if (ele != NULL) {
|
||||||
nvl->nvl_flags |= NV_FLAG_IN_ARRAY;
|
nvl->nvl_flags |= NV_FLAG_IN_ARRAY;
|
||||||
else
|
} else {
|
||||||
nvl->nvl_flags &= ~NV_FLAG_IN_ARRAY;
|
nvl->nvl_flags &= ~NV_FLAG_IN_ARRAY;
|
||||||
|
nv_free(nvl->nvl_array_next);
|
||||||
|
}
|
||||||
|
|
||||||
nvl->nvl_array_next = ele;
|
nvl->nvl_array_next = ele;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user