git: ea81d41cfbfe - 2021Q4 - dns/bind916: fix runnaway memory leak

From: Mathieu Arnold <mat_at_FreeBSD.org>
Date: Wed, 15 Dec 2021 16:03:14 UTC
The branch 2021Q4 has been updated by mat:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ea81d41cfbfebbe814c1dd0cd5650e7dee5b0c1b

commit ea81d41cfbfebbe814c1dd0cd5650e7dee5b0c1b
Author:     Mathieu Arnold <mat@FreeBSD.org>
AuthorDate: 2021-12-15 15:58:37 +0000
Commit:     Mathieu Arnold <mat@FreeBSD.org>
CommitDate: 2021-12-15 16:02:39 +0000

    dns/bind916: fix runnaway memory leak
    
    Obtained from:  https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/5626
    
    (cherry picked from commit 925b730fbf94cffa1215f3a30bee4c27f0ae36c7)
---
 dns/bind916/Makefile            |  2 +-
 dns/bind916/files/patch-mr-5626 | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/dns/bind916/Makefile b/dns/bind916/Makefile
index e3c09b5b9b4e..0c1dcee790c2 100644
--- a/dns/bind916/Makefile
+++ b/dns/bind916/Makefile
@@ -7,7 +7,7 @@ PORTVERSION=	${ISCVERSION:S/-P/P/:S/b/.b/:S/a/.a/:S/rc/.rc/}
 PORTREVISION=	0
 .else
 # dns/bind916 here
-PORTREVISION=	0
+PORTREVISION=	1
 .endif
 CATEGORIES=	dns net
 MASTER_SITES=	ISC/bind9/${ISCVERSION}
diff --git a/dns/bind916/files/patch-mr-5626 b/dns/bind916/files/patch-mr-5626
new file mode 100644
index 000000000000..6cb9becc16e0
--- /dev/null
+++ b/dns/bind916/files/patch-mr-5626
@@ -0,0 +1,21 @@
+--- lib/isc/netmgr/netmgr.c.orig	2021-12-07 12:24:49 UTC
++++ lib/isc/netmgr/netmgr.c
+@@ -425,6 +425,7 @@ nm_destroy(isc_nm_t **mgr0) {
+ 			isc_mempool_put(mgr->evpool, ievent);
+ 		}
+ 		isc_condition_destroy(&worker->cond_prio);
++		isc_mutex_destroy(&worker->lock);
+ 
+ 		r = uv_loop_close(&worker->loop);
+ 		INSIST(r == 0);
+@@ -1267,8 +1268,9 @@ nmsocket_cleanup(isc_nmsocket_t *sock, bool dofree FLA
+ 
+ 	isc_mem_free(sock->mgr->mctx, sock->ah_frees);
+ 	isc_mem_free(sock->mgr->mctx, sock->ah_handles);
+-	isc_mutex_destroy(&sock->lock);
+ 	isc_condition_destroy(&sock->scond);
++	isc_condition_destroy(&sock->cond);
++	isc_mutex_destroy(&sock->lock);
+ #ifdef NETMGR_TRACE
+ 	LOCK(&sock->mgr->lock);
+ 	ISC_LIST_UNLINK(sock->mgr->active_sockets, sock, active_link);