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

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