From fc46de686ed7f60b33c75c84059c5679a8b5b61d Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Apr 25 2019 11:51:51 +0000 Subject: Ticket 50340 - structs for diabled plugins will not be freed Bug: when plugins are loaded from dse.ldif enabled plugins will be added to the list of the plugin type and freed when plugins are stopped. But the memory allocated for disabled plugins will remain allocated and and be reported. Fix: free plugin if not enabled after loading This will alos let the many leaks reported for "GrowStuff" disappear. The fix also contains one missing free for slapi_ch_smprintf allocated memory Reviewed by: Mark, thanks --- diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c index 94928c7..c2eff21 100644 --- a/ldap/servers/slapd/ldaputil.c +++ b/ldap/servers/slapd/ldaputil.c @@ -779,6 +779,7 @@ slapi_ldap_init_ext( if (PR_SUCCESS != PR_CallOnce(&ol_init_callOnce, internal_ol_init_init)) { slapi_log_err(SLAPI_LOG_ERR, "slapi_ldap_init_ext", "Could not perform internal ol_init init\n"); + slapi_ch_free_string(&makeurl); rc = -1; goto done; } diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c index 9e1c1b4..601a012 100644 --- a/ldap/servers/slapd/plugin.c +++ b/ldap/servers/slapd/plugin.c @@ -3040,7 +3040,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group, slapi_p } PLUGIN_CLEANUP: - if (status) { + if (status || !enabled) { plugin_free(plugin); } slapi_ch_free((void **)&configdir);