Coverity issues in contrail-controller/pkt0_interface_base.cc

Bug #1770422 reported by Anda Nicolae on 2018-05-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R5.0
Fix Committed
Undecided
Anda Nicolae
Trunk
Fix Committed
Undecided
Anda Nicolae
OpenContrail
New
Undecided
Unassigned

Bug Description

Hi all,

I have run Coverity on branch R5.0 and it reported the following issue in contrail-controller/pkt0_interface_base.cc:

- double_free: Calling ~Pkt0Interface frees pointer this->read_buff_ which has already been freed in pkt0_interface_base.cc:~Pkt0RawInterface()

Indeed, Pkt0RawInterface inherits Pkt0Interface. read_buff_ pointer is freed in both the destructor of Pkt0Interface and in the destructor of Pkt0RawInterface.
Solution is to free read_buff_ only the desturcotr of the base class: Pkt0Interface.

Review in progress for https://review.opencontrail.org/42940
Submitter: Anda Nicolae (<email address hidden>)

Jeba Paulaiyan (jebap) on 2018-05-10
tags: added: vrouter

Review in progress for https://review.opencontrail.org/43021
Submitter: Anda Nicolae (<email address hidden>)

Review in progress for https://review.opencontrail.org/42940
Submitter: Anda Nicolae (<email address hidden>)

Review in progress for https://review.opencontrail.org/43021
Submitter: Ananth Suryanarayana (<email address hidden>)

Reviewed: https://review.opencontrail.org/43021
Committed: http://github.com/Juniper/contrail-controller/commit/e77a3b7c2f69a29bfd56bd6d9bc22a63d5ca42f5
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit e77a3b7c2f69a29bfd56bd6d9bc22a63d5ca42f5
Author: Anda Nicolae <email address hidden>
Date: Thu May 10 17:47:12 2018 +0300

Coverity issues in contrail-controller/pkt0_interface_base.cc

I have run Coverity on branch R5.0 and it reported the following
issue in contrail-controller/pkt0_interface_base.cc:

- double_free: Calling ~Pkt0Interface frees pointer this->read_buff_
which has already been freed in pkt0_interface_base.cc:~Pkt0RawInterface()

Indeed, Pkt0RawInterface inherits Pkt0Interface. read_buff_ pointer is freed
in both the destructor of Pkt0Interface and in the destructor of Pkt0RawInterface.
Solution is to free read_buff_ only in the destructor of the base class: Pkt0Interface.

Change-Id: Idfd6ce06a9cc561fb9da76ce0aaf985e9c51ab71
Closes-Bug: #1770422
Signed-off-by: Anda Nicolae <email address hidden>

Reviewed: https://review.opencontrail.org/42940
Committed: http://github.com/Juniper/contrail-controller/commit/ca6e03c0f066cc9e80932cd69771bce1b5a60d0c
Submitter: Zuul v3 CI (<email address hidden>)
Branch: R5.0

commit ca6e03c0f066cc9e80932cd69771bce1b5a60d0c
Author: Anda Nicolae <email address hidden>
Date: Thu May 10 17:47:12 2018 +0300

Coverity issues in contrail-controller/pkt0_interface_base.cc

I have run Coverity on branch R5.0 and it reported the following
issue in contrail-controller/pkt0_interface_base.cc:

- double_free: Calling ~Pkt0Interface frees pointer this->read_buff_
which has already been freed in pkt0_interface_base.cc:~Pkt0RawInterface()

Indeed, Pkt0RawInterface inherits Pkt0Interface. read_buff_ pointer is freed
in both the destructor of Pkt0Interface and in the destructor of Pkt0RawInterface.
Solution is to free read_buff_ only in the destructor of the base class: Pkt0Interface.

Change-Id: Idfd6ce06a9cc561fb9da76ce0aaf985e9c51ab71
Closes-Bug: #1770422
Signed-off-by: Anda Nicolae <email address hidden>

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers