Browse Source

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.
Nathan Kinder 14 năm trước cách đây
mục cha
commit
576d90b255
1 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 7 2
      ldap/servers/plugins/replication/windows_protocol_util.c

+ 7 - 2
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);