From: Marcin Siodelski Date: Wed, 1 Oct 2014 09:38:35 +0000 (+0200) Subject: [3589] CfgOptionDef::copy overrides old configuration. X-Git-Tag: trac3162a_base~4^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bcd7471987eebd3793e254e08cf607c13eb6afdd;p=thirdparty%2Fkea.git [3589] CfgOptionDef::copy overrides old configuration. --- diff --git a/src/lib/dhcpsrv/cfg_option_def.cc b/src/lib/dhcpsrv/cfg_option_def.cc index 00e73ff11d..130a9ee102 100644 --- a/src/lib/dhcpsrv/cfg_option_def.cc +++ b/src/lib/dhcpsrv/cfg_option_def.cc @@ -22,6 +22,8 @@ namespace dhcp { void CfgOptionDef::copyTo(CfgOptionDef& new_config) const { + // Remove any existing option definitions from the destination. + new_config.option_definitions_.clearItems(); const std::list& names = option_definitions_.getOptionSpaceNames(); for (std::list::const_iterator name = names.begin(); diff --git a/src/lib/dhcpsrv/cfg_option_def.h b/src/lib/dhcpsrv/cfg_option_def.h index fadc8b6d44..09932acfd2 100644 --- a/src/lib/dhcpsrv/cfg_option_def.h +++ b/src/lib/dhcpsrv/cfg_option_def.h @@ -43,11 +43,6 @@ public: /// to an object passed as parameter. There are no shared objects or /// pointers between the original object and a copy. /// - /// @warning This function doesn't perform a cleanup of the @c new_config - /// before copying the new configuration into it. It is caller's - /// responsibility to make sure that this object doesn't contain any - /// garbage data. - /// /// @param [out] new_config An object to which the configuration will be /// copied. void copyTo(CfgOptionDef& new_config) const;