Blob Blame History Raw
From cbe93b4bd4569181db85aeac501798985d7d1acd Mon Sep 17 00:00:00 2001
From: Thierry Bordaz <tbordaz@redhat.com>
Date: Fri, 24 Jan 2020 10:56:23 +0100
Subject: [PATCH] Ticket 50709: (cont) Several memory leaks reported by
 Valgrind for 389-ds 1.3.9.1-10

Bug Description:
	Cherry pick from master was broken because connection locking
	uses pthread lock in master while it remains Monitor in 1.3.10

Fix Description:
	Change the locking function to use Monitor in that branch

https://pagure.io/389-ds-base/issue/50709

Reviewed by: thierry bordaz

Platforms tested: 7.8

Flag Day: no

Doc impact: no
---
 ldap/servers/slapd/pblock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index d2ad6147a..d21cf7e76 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -486,9 +486,9 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
         if (pblock->pb_conn == NULL) {
             break;
         }
-        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
+        PR_EnterMonitor(pblock->pb_conn->c_mutex);
         (*(PRNetAddr **) value) = pblock->pb_conn->cin_addr_aclip;
-        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
+        PR_ExitMonitor(pblock->pb_conn->c_mutex);
         break;
     case SLAPI_CONN_SERVERNETADDR:
         if (pblock->pb_conn == NULL) {
@@ -2583,10 +2583,10 @@ slapi_pblock_set(Slapi_PBlock *pblock, int arg, void *value)
         if (pblock->pb_conn == NULL) {
             break;
         }
-        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
+        PR_EnterMonitor(pblock->pb_conn->c_mutex);
         slapi_ch_free((void **)&pblock->pb_conn->cin_addr_aclip);
         pblock->pb_conn->cin_addr_aclip = (PRNetAddr *)value;
-        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
+        PR_ExitMonitor(pblock->pb_conn->c_mutex);
     case SLAPI_CONN_IS_REPLICATION_SESSION:
         if (pblock->pb_conn == NULL) {
             slapi_log_err(SLAPI_LOG_ERR,
-- 
2.24.1