Blame SOURCES/0021-Ticket-50709-cont-Several-memory-leaks-reported-by-V.patch

e52775
From cbe93b4bd4569181db85aeac501798985d7d1acd Mon Sep 17 00:00:00 2001
e52775
From: Thierry Bordaz <tbordaz@redhat.com>
e52775
Date: Fri, 24 Jan 2020 10:56:23 +0100
e52775
Subject: [PATCH] Ticket 50709: (cont) Several memory leaks reported by
e52775
 Valgrind for 389-ds 1.3.9.1-10
e52775
e52775
Bug Description:
e52775
	Cherry pick from master was broken because connection locking
e52775
	uses pthread lock in master while it remains Monitor in 1.3.10
e52775
e52775
Fix Description:
e52775
	Change the locking function to use Monitor in that branch
e52775
e52775
https://pagure.io/389-ds-base/issue/50709
e52775
e52775
Reviewed by: thierry bordaz
e52775
e52775
Platforms tested: 7.8
e52775
e52775
Flag Day: no
e52775
e52775
Doc impact: no
e52775
---
e52775
 ldap/servers/slapd/pblock.c | 8 ++++----
e52775
 1 file changed, 4 insertions(+), 4 deletions(-)
e52775
e52775
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
e52775
index d2ad6147a..d21cf7e76 100644
e52775
--- a/ldap/servers/slapd/pblock.c
e52775
+++ b/ldap/servers/slapd/pblock.c
e52775
@@ -486,9 +486,9 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
e52775
         if (pblock->pb_conn == NULL) {
e52775
             break;
e52775
         }
e52775
-        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
e52775
+        PR_EnterMonitor(pblock->pb_conn->c_mutex);
e52775
         (*(PRNetAddr **) value) = pblock->pb_conn->cin_addr_aclip;
e52775
-        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
e52775
+        PR_ExitMonitor(pblock->pb_conn->c_mutex);
e52775
         break;
e52775
     case SLAPI_CONN_SERVERNETADDR:
e52775
         if (pblock->pb_conn == NULL) {
e52775
@@ -2583,10 +2583,10 @@ slapi_pblock_set(Slapi_PBlock *pblock, int arg, void *value)
e52775
         if (pblock->pb_conn == NULL) {
e52775
             break;
e52775
         }
e52775
-        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
e52775
+        PR_EnterMonitor(pblock->pb_conn->c_mutex);
e52775
         slapi_ch_free((void **)&pblock->pb_conn->cin_addr_aclip);
e52775
         pblock->pb_conn->cin_addr_aclip = (PRNetAddr *)value;
e52775
-        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
e52775
+        PR_ExitMonitor(pblock->pb_conn->c_mutex);
e52775
     case SLAPI_CONN_IS_REPLICATION_SESSION:
e52775
         if (pblock->pb_conn == NULL) {
e52775
             slapi_log_err(SLAPI_LOG_ERR,
e52775
-- 
e52775
2.24.1
e52775