svn commit: r302966 - head/sys/contrib/libnv
Mariusz Zaborski
oshogbo at FreeBSD.org
Sun Jul 17 15:36:04 UTC 2016
Author: oshogbo
Date: Sun Jul 17 15:36:02 2016
New Revision: 302966
URL: https://svnweb.freebsd.org/changeset/base/302966
Log:
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 at gmail.com>
MFC after: 1 week
Modified:
head/sys/contrib/libnv/nvlist.c
Modified: head/sys/contrib/libnv/nvlist.c
==============================================================================
--- head/sys/contrib/libnv/nvlist.c Sun Jul 17 15:29:31 2016 (r302965)
+++ head/sys/contrib/libnv/nvlist.c Sun Jul 17 15:36:02 2016 (r302966)
@@ -236,10 +236,12 @@ nvlist_set_array_next(nvlist_t *nvl, nvp
NVLIST_ASSERT(nvl);
- if (ele != NULL)
+ if (ele != NULL) {
nvl->nvl_flags |= NV_FLAG_IN_ARRAY;
- else
+ } else {
nvl->nvl_flags &= ~NV_FLAG_IN_ARRAY;
+ nv_free(nvl->nvl_array_next);
+ }
nvl->nvl_array_next = ele;
}
More information about the svn-src-all
mailing list