From 93f079a9eea2472e9481bfd482a624f980e17c9a Mon Sep 17 00:00:00 2001 From: Nathan Kinder Date: Sep 01 2011 17:16:06 +0000 Subject: Bug 722292 - (cov#11030) Leak of mapped_sdn in winsync rename code The previous fix for bug 722292 introduced a memory leak of the mapped DN used to detect entry renames. This ensures that we free the mapped DN. --- diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c index a1c8c0d..771475b 100644 --- a/ldap/servers/plugins/replication/windows_protocol_util.c +++ b/ldap/servers/plugins/replication/windows_protocol_util.c @@ -4509,7 +4509,7 @@ windows_update_local_entry(Private_Repl_Protocol *prp,Slapi_Entry *remote_entry, newrdn ? newrdn:"NULL", newsuperior ? newsuperior:"NULL"); slapi_ch_free_string(&newsuperior); slapi_rdn_done(&rdn); - return retval; + goto bail; } slapi_ch_free_string(&newsuperior); slapi_rdn_done(&rdn); @@ -4524,10 +4524,12 @@ windows_update_local_entry(Private_Repl_Protocol *prp,Slapi_Entry *remote_entry, "failed to get local entry \"%s\" after rename\n", slapi_sdn_get_ndn(mapped_sdn)); local_entry = orig_local_entry; - return retval; + orig_local_entry = NULL; + goto bail; } } + slapi_mods_init (&smods, 0); retval = windows_generate_update_mods(prp,remote_entry,local_entry,0,&smods,&do_modify); @@ -4566,6 +4568,9 @@ windows_update_local_entry(Private_Repl_Protocol *prp,Slapi_Entry *remote_entry, slapi_log_error(SLAPI_LOG_REPL, windows_repl_plugin_name, "no mods generated for local entry: %s\n", escape_string(dn, dnbuf)); } + +bail: + slapi_sdn_free(&mapped_sdn); slapi_mods_done(&smods); if (orig_local_entry) { slapi_entry_free(local_entry);