summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-07-26 13:32:30 -0500
committerNoriko Hosoi <nhosoi@redhat.com>2010-08-19 17:01:11 -0700
commit50081f7a2fcd51944b81e5d49b49cc4cda7abd29 (patch)
treeb4c66f3aa310fc567ec51c73c02d5305e3edf203
parentc9ab0b942a5428e00460ce33c97ff08d0bfb255f (diff)
Bug 617630 - fix coverify Defect Type: Resource leaks issues CID 12052 - 12093
https://bugzilla.redhat.com/show_bug.cgi?id=617630 Resolves: bug 617630 Bug description: fix coverify Defect Type: Resource leaks issues CID 12084, 12085. description: range_candidates() has been modified to release highs if an error occurs.
-rw-r--r--ldap/servers/slapd/back-ldbm/filterindex.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
index b77103b6..19335085 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -523,7 +523,7 @@ range_candidates(
const Slapi_Attr *sattr
)
{
- IDList *idl;
+ IDList *idl = NULL;
struct berval *low = NULL, *high = NULL;
struct berval **lows = NULL, **highs = NULL;
@@ -534,7 +534,8 @@ range_candidates(
if (lows == NULL || *lows == NULL) {
LDAPDebug( LDAP_DEBUG_TRACE,
"<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
- return( idl_allids( be ) );
+ idl = idl_allids( be );
+ goto done;
}
low = attr_value_lowest(lows, slapi_berval_reverse_cmp);
}
@@ -544,8 +545,8 @@ range_candidates(
if (highs == NULL || *highs == NULL) {
LDAPDebug( LDAP_DEBUG_TRACE,
"<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
- if (lows) ber_bvecfree(lows);
- return( idl_allids( be ) );
+ idl = idl_allids( be );
+ goto done;
}
high = attr_value_lowest(highs, slapi_berval_cmp);
}
@@ -564,6 +565,7 @@ range_candidates(
low, high, 1, NULL, err);
}
+done:
if (lows) ber_bvecfree(lows);
if (highs) ber_bvecfree(highs);