Skip to content

Commit

Permalink
Coverity issues in contrail-controller/pkt0_interface_base.cc
Browse files Browse the repository at this point in the history
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 <anicolae@lenovo.com>
  • Loading branch information
Anda Nicolae committed Jun 5, 2018
1 parent 35f6485 commit ca6e03c
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/vnsw/agent/contrail/pkt0_interface_base.cc
Expand Up @@ -113,9 +113,6 @@ Pkt0RawInterface::Pkt0RawInterface(const std::string &name,
}

Pkt0RawInterface::~Pkt0RawInterface() {
if (read_buff_) {
delete [] read_buff_;
}
}

// Pkt0Socket is not supported on Windows
Expand Down

0 comments on commit ca6e03c

Please sign in to comment.