From: Razvan Becheriu Date: Mon, 27 Jul 2020 14:54:42 +0000 (+0300) Subject: [#1065] addressed review X-Git-Tag: Kea-1.8.0~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b3387189b934e6cb0afdbc46c34b538e2252cc5;p=thirdparty%2Fkea.git [#1065] addressed review --- diff --git a/src/hooks/dhcp/lease_cmds/lease_cmds.cc b/src/hooks/dhcp/lease_cmds/lease_cmds.cc index 63080cd91a..6222dbf975 100644 --- a/src/hooks/dhcp/lease_cmds/lease_cmds.cc +++ b/src/hooks/dhcp/lease_cmds/lease_cmds.cc @@ -607,8 +607,8 @@ namespace { // anonymous namespace. bool addOrUpdate4(Lease4Ptr lease, bool force_create) { - Lease4Ptr lease4 = LeaseMgrFactory::instance().getLease4(lease->addr_); - if (force_create && !lease4) { + Lease4Ptr existing = LeaseMgrFactory::instance().getLease4(lease->addr_); + if (force_create && !existing) { // lease does not exist if (!LeaseMgrFactory::instance().addLease(lease)) { isc_throw(db::DuplicateEntry, @@ -618,15 +618,15 @@ addOrUpdate4(Lease4Ptr lease, bool force_create) { return (true); } LeaseMgrFactory::instance().updateLease4(lease); - LeaseCmdsImpl::updateStatsOnUpdate(lease4, lease); + LeaseCmdsImpl::updateStatsOnUpdate(existing, lease); return (false); } bool addOrUpdate6(Lease6Ptr lease, bool force_create) { - Lease6Ptr lease6 = + Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(lease->type_, lease->addr_); - if (force_create && !lease6) { + if (force_create && !existing) { // lease does not exist if (!LeaseMgrFactory::instance().addLease(lease)) { isc_throw(db::DuplicateEntry, @@ -636,7 +636,7 @@ addOrUpdate6(Lease6Ptr lease, bool force_create) { return (true); } LeaseMgrFactory::instance().updateLease6(lease); - LeaseCmdsImpl::updateStatsOnUpdate(lease6, lease); + LeaseCmdsImpl::updateStatsOnUpdate(existing, lease); return (false); }