Blame SOURCES/0014-Issue-4396-Minor-memory-leak-in-backend-4558-4572.patch

e4a41f
From b3170e39519530c39d59202413b20e6bd466224d Mon Sep 17 00:00:00 2001
e4a41f
From: James Chapman <jachapma@redhat.com>
e4a41f
Date: Wed, 27 Jan 2021 09:56:38 +0000
e4a41f
Subject: [PATCH 2/3] Issue 4396 - Minor memory leak in backend (#4558) (#4572)
e4a41f
e4a41f
Bug Description: As multiple suffixes per backend were no longer used, this
e4a41f
functionality has been replaced with a single suffix per backend. Legacy
e4a41f
code remains that adds multiple suffixes to the dse internal backend,
e4a41f
resulting in memory allocations that are lost.
e4a41f
e4a41f
Also a minor typo is corrected in backend.c
e4a41f
e4a41f
Fix Description: Calls to be_addsuffix on the DSE backend are removed
e4a41f
as they are never used.
e4a41f
e4a41f
Fixes: https://github.com/389ds/389-ds-base/issues/4396
e4a41f
e4a41f
Reviewed by: mreynolds389, Firstyear, droideck (Thank you)
e4a41f
---
e4a41f
 ldap/servers/slapd/backend.c |  2 +-
e4a41f
 ldap/servers/slapd/fedse.c   | 12 +++---------
e4a41f
 2 files changed, 4 insertions(+), 10 deletions(-)
e4a41f
e4a41f
diff --git a/ldap/servers/slapd/backend.c b/ldap/servers/slapd/backend.c
e4a41f
index bc52b4643..5707504a9 100644
e4a41f
--- a/ldap/servers/slapd/backend.c
e4a41f
+++ b/ldap/servers/slapd/backend.c
e4a41f
@@ -42,7 +42,7 @@ be_init(Slapi_Backend *be, const char *type, const char *name, int isprivate, in
e4a41f
     }
e4a41f
     be->be_monitordn = slapi_create_dn_string("cn=monitor,cn=%s,cn=%s,cn=plugins,cn=config",
e4a41f
                                               name, type);
e4a41f
-    if (NULL == be->be_configdn) {
e4a41f
+    if (NULL == be->be_monitordn) {
e4a41f
         slapi_log_err(SLAPI_LOG_ERR,
e4a41f
                       "be_init", "Failed create instance monitor dn for "
e4a41f
                                  "plugin %s, instance %s\n",
e4a41f
diff --git a/ldap/servers/slapd/fedse.c b/ldap/servers/slapd/fedse.c
e4a41f
index 0d645f909..7b820b540 100644
e4a41f
--- a/ldap/servers/slapd/fedse.c
e4a41f
+++ b/ldap/servers/slapd/fedse.c
e4a41f
@@ -2827,7 +2827,7 @@ search_snmp(Slapi_PBlock *pb __attribute__((unused)),
e4a41f
 }
e4a41f
 
e4a41f
 /*
e4a41f
- * Called from config.c to install the internal backends
e4a41f
+ * Called from main.c to install the internal backends
e4a41f
  */
e4a41f
 int
e4a41f
 setup_internal_backends(char *configdir)
e4a41f
@@ -2846,7 +2846,6 @@ setup_internal_backends(char *configdir)
e4a41f
         Slapi_DN counters;
e4a41f
         Slapi_DN snmp;
e4a41f
         Slapi_DN root;
e4a41f
-        Slapi_Backend *be;
e4a41f
         Slapi_DN encryption;
e4a41f
         Slapi_DN saslmapping;
e4a41f
         Slapi_DN plugins;
e4a41f
@@ -2895,16 +2894,11 @@ setup_internal_backends(char *configdir)
e4a41f
         dse_register_callback(pfedse, SLAPI_OPERATION_ADD, DSE_FLAG_PREOP, &saslmapping, LDAP_SCOPE_SUBTREE, "(objectclass=nsSaslMapping)", sasl_map_config_add, NULL, NULL);
e4a41f
         dse_register_callback(pfedse, SLAPI_OPERATION_ADD, DSE_FLAG_PREOP, &plugins, LDAP_SCOPE_SUBTREE, "(objectclass=nsSlapdPlugin)", check_plugin_path, NULL, NULL);
e4a41f
 
e4a41f
-        be = be_new_internal(pfedse, "DSE", DSE_BACKEND, &fedse_plugin);
e4a41f
-        be_addsuffix(be, &root);
e4a41f
-        be_addsuffix(be, &monitor);
e4a41f
-        be_addsuffix(be, &config);
e4a41f
+        be_new_internal(pfedse, "DSE", DSE_BACKEND, &fedse_plugin);
e4a41f
 
e4a41f
         /*
e4a41f
-         * Now that the be's are in place, we can
e4a41f
-         * setup the mapping tree.
e4a41f
+         * Now that the be's are in place, we can setup the mapping tree.
e4a41f
          */
e4a41f
-
e4a41f
         if (mapping_tree_init()) {
e4a41f
             slapi_log_err(SLAPI_LOG_EMERG, "setup_internal_backends", "Failed to init mapping tree\n");
e4a41f
             exit(1);
e4a41f
-- 
e4a41f
2.31.1
e4a41f