|
|
dc8c34 |
From 1a63cadc6e87ffb8ed410af3283f1395c0f84d07 Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Rich Megginson <rmeggins@redhat.com>
|
|
|
dc8c34 |
Date: Wed, 9 Apr 2014 13:24:26 -0600
|
|
|
dc8c34 |
Subject: [PATCH 198/225] Ticket #47774 mem leak in do_search - rawbase not
|
|
|
dc8c34 |
freed upon certain errors
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/47774
|
|
|
dc8c34 |
Reviewed by: nhosoi (Thanks!)
|
|
|
dc8c34 |
Branch: 389-ds-base-1.2.11
|
|
|
dc8c34 |
Fix Description: Free the local rawbase variable if it was not set in the
|
|
|
dc8c34 |
pblock.
|
|
|
dc8c34 |
Platforms tested: RHEL6 x86_64
|
|
|
dc8c34 |
Flag Day: no
|
|
|
dc8c34 |
Doc impact: no
|
|
|
dc8c34 |
(cherry picked from commit 1d5c6d6ca300a45305dba631a334ae9a1857d4cb)
|
|
|
dc8c34 |
(cherry picked from commit b065515935daa8fffe7a8eef3a66621cc8702018)
|
|
|
dc8c34 |
(cherry picked from commit 97f58ff4787ecb87780fde7245e354ec75e73125)
|
|
|
dc8c34 |
(cherry picked from commit 33bf4d42727804f5c10ce30834a2340c99cad459)
|
|
|
dc8c34 |
(cherry picked from commit 9426e0788c85fef950d41d2d5427b5b67fa6b0fd)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/slapd/search.c | 6 +++++-
|
|
|
dc8c34 |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c
|
|
|
dc8c34 |
index 9f165a1..1f0050c 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/search.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/search.c
|
|
|
dc8c34 |
@@ -69,6 +69,7 @@ do_search( Slapi_PBlock *pb )
|
|
|
dc8c34 |
int i, err, attrsonly;
|
|
|
dc8c34 |
ber_int_t scope, deref, sizelimit, timelimit;
|
|
|
dc8c34 |
char *rawbase = NULL;
|
|
|
dc8c34 |
+ int rawbase_set_in_pb = 0; /* was rawbase set in pb? */
|
|
|
dc8c34 |
char *base = NULL, *fstr = NULL;
|
|
|
dc8c34 |
struct slapi_filter *filter = NULL;
|
|
|
dc8c34 |
char **attrs = NULL;
|
|
|
dc8c34 |
@@ -339,6 +340,7 @@ do_search( Slapi_PBlock *pb )
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
slapi_pblock_set( pb, SLAPI_ORIGINAL_TARGET_DN, rawbase );
|
|
|
dc8c34 |
+ rawbase_set_in_pb = 1; /* rawbase is now owned by pb */
|
|
|
dc8c34 |
slapi_pblock_set( pb, SLAPI_SEARCH_SCOPE, &scope );
|
|
|
dc8c34 |
slapi_pblock_set( pb, SLAPI_SEARCH_DEREF, &deref );
|
|
|
dc8c34 |
slapi_pblock_set( pb, SLAPI_SEARCH_FILTER, filter );
|
|
|
dc8c34 |
@@ -375,7 +377,9 @@ free_and_return:;
|
|
|
dc8c34 |
operation->o_flags &= ~OP_FLAG_PS;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
/* we strdup'd this above - need to free */
|
|
|
dc8c34 |
- slapi_pblock_get(pb, SLAPI_ORIGINAL_TARGET_DN, &rawbase);
|
|
|
dc8c34 |
+ if (rawbase_set_in_pb) {
|
|
|
dc8c34 |
+ slapi_pblock_get(pb, SLAPI_ORIGINAL_TARGET_DN, &rawbase);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
slapi_ch_free_string(&rawbase);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.8.1.4
|
|
|
dc8c34 |
|