zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone

Blame SOURCES/0075-Ticket-47623-fix-memleak-caused-by-47347.patch

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