git: bc2bc8ee6e18 - stable/12 - libnv: fix memory leaks

Mariusz Zaborski oshogbo at FreeBSD.org
Tue Jul 6 18:25:56 UTC 2021


The branch stable/12 has been updated by oshogbo:

URL: https://cgit.FreeBSD.org/src/commit/?id=bc2bc8ee6e1814361125c189591917be0fa5e4c1

commit bc2bc8ee6e1814361125c189591917be0fa5e4c1
Author:     Mariusz Zaborski <oshogbo at FreeBSD.org>
AuthorDate: 2019-02-10 23:30:54 +0000
Commit:     Mariusz Zaborski <oshogbo at FreeBSD.org>
CommitDate: 2021-07-06 17:58:08 +0000

    libnv: fix memory leaks
    
    Free the data array for NV_TYPE_DESCRIPTOR_ARRAY case.
    
    MFC after:      2 weeks
    
    (cherry picked from commit 0020c845a086766b3315372f006363f8ad76ac54)
---
 sys/contrib/libnv/nvpair.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/contrib/libnv/nvpair.c b/sys/contrib/libnv/nvpair.c
index b767b9bbf972..556203f740fc 100644
--- a/sys/contrib/libnv/nvpair.c
+++ b/sys/contrib/libnv/nvpair.c
@@ -2062,6 +2062,7 @@ nvpair_free(nvpair_t *nvp)
 	case NV_TYPE_DESCRIPTOR_ARRAY:
 		for (i = 0; i < nvp->nvp_nitems; i++)
 			close(((int *)(intptr_t)nvp->nvp_data)[i]);
+		nv_free((int *)(intptr_t)nvp->nvp_data);
 		break;
 #endif
 	case NV_TYPE_NVLIST:


More information about the dev-commits-src-branches mailing list