Date: Mon, 8 Aug 2016 06:33:57 +0000 (UTC) From: Mariusz Zaborski <oshogbo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r303826 - stable/11/sys/contrib/libnv Message-ID: <201608080633.u786Xv0e027590@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: oshogbo Date: Mon Aug 8 06:33:57 2016 New Revision: 303826 URL: https://svnweb.freebsd.org/changeset/base/303826 Log: MFC r302966: 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> Approved by: re (gjb) Modified: stable/11/sys/contrib/libnv/nvlist.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/contrib/libnv/nvlist.c ============================================================================== --- stable/11/sys/contrib/libnv/nvlist.c Mon Aug 8 06:29:25 2016 (r303825) +++ stable/11/sys/contrib/libnv/nvlist.c Mon Aug 8 06:33:57 2016 (r303826) @@ -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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608080633.u786Xv0e027590>