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

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