From 9812613da4adcf356ef9689b3eea0f9ce795efa8 Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@redhat.com>
Date: Tue, 10 Dec 2013 08:08:35 -0700
Subject: [PATCH 114/115] Ticket #47623 fix memleak caused by 47347
https://fedorahosted.org/389/ticket/47623
Reviewed by: tbordaz, nhosoi (Thanks!)
Branch: 389-ds-base-1.2.11
Fix Description: Create the mutex if it doesn't exist.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit 0d4849dd7551347f0e24ac1027f4d0501084dcf3)
(cherry picked from commit 5d3ae5f709964cd7dfb73b631a22389223f5ef25)
(cherry picked from commit 5c649ddacd1d2c11b6e922b29472094b780c2a0e)
(cherry picked from commit 75ed4b36722eeff8dc2d6aad0cf5e32dc474c3a7)
(cherry picked from commit 1eb281a8a1c5d6c1a22c198a23a8ba7b65991d77)
---
ldap/servers/slapd/pagedresults.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index a835d6b..9af5773 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -122,7 +122,6 @@ pagedresults_parse_control_value( Slapi_PBlock *pb,
sizeof(PagedResults) * maxlen);
}
*index = maxlen; /* the first position in the new area */
- conn->c_pagedresults.prl_list[*index].pr_mutex = PR_NewLock();
} else {
for (i = 0; i < conn->c_pagedresults.prl_maxlen; i++) {
if (!conn->c_pagedresults.prl_list[i].pr_current_be) {
@@ -131,6 +130,9 @@ pagedresults_parse_control_value( Slapi_PBlock *pb,
}
}
}
+ if (!conn->c_pagedresults.prl_list[*index].pr_mutex) {
+ conn->c_pagedresults.prl_list[*index].pr_mutex = PR_NewLock();
+ }
conn->c_pagedresults.prl_count++;
} else {
/* Repeated paged results request.
--
1.8.1.4