From 877df07df2e41988a797778b132935b7d8acfd87 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Fri, 5 Aug 2022 14:07:18 -0400
Subject: [PATCH 4/5] Issue 5397 - Fix various memory leaks
Description:
Fixed memory leaks in:
- Filter optimizer introduced sr_norm_filter_intent which dupped a filter
but never freed it.
- Replication connections would leak the replication manager's
credentials.
relates: https://github.com/389ds/389-ds-base/issues/5397
Reviewed by: progier & jchapman (Thanks!!)
---
ldap/servers/plugins/replication/repl5_connection.c | 1 +
ldap/servers/slapd/back-ldbm/ldbm_search.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index b6bc21c46..be8bba08e 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -247,6 +247,7 @@ conn_delete_internal(Repl_Connection *conn)
slapi_ch_free_string(&conn->last_ldap_errmsg);
slapi_ch_free((void **)&conn->hostname);
slapi_ch_free((void **)&conn->binddn);
+ slapi_ch_free((void **)&conn->creds);
slapi_ch_free((void **)&conn->plain);
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index d0f52b6f7..771c35a33 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -1930,6 +1930,7 @@ delete_search_result_set(Slapi_PBlock *pb, back_search_result_set **sr)
rc, filt_errs);
}
slapi_filter_free((*sr)->sr_norm_filter, 1);
+ slapi_filter_free((*sr)->sr_norm_filter_intent, 1);
memset(*sr, 0, sizeof(back_search_result_set));
slapi_ch_free((void **)sr);
return;
--
2.37.1