[Coverity] Dereference before null check (REVERSE_INULL)

This commit is contained in:
Peter D. Barnes, Jr.
2013-05-15 14:00:06 -04:00
parent a4917e8935
commit 2af3c22d07
3 changed files with 4 additions and 4 deletions

View File

@@ -278,7 +278,7 @@ TestCase::CreateDataDirFilename (std::string filename)
{
NS_LOG_FUNCTION (this << filename);
const TestCase *current = this;
while (current->m_dataDir == "" && current != 0)
while (current != 0 && current->m_dataDir == "")
{
current = current->m_parent;
}

View File

@@ -2104,7 +2104,7 @@ RoutingProtocol::LinkSensing (const olsr::MessageHeader &msg,
}
// Schedules link tuple deletion
if (created && link_tuple != NULL)
if (created)
{
LinkTupleAdded (*link_tuple, hello.willingness);
m_events.Track (Simulator::Schedule (DELAY (std::min (link_tuple->time, link_tuple->symTime)),

View File

@@ -940,9 +940,9 @@ ProtocolTlvValue::ProtocolTlvValue ()
}
ProtocolTlvValue::~ProtocolTlvValue ()
{
m_protocol->clear ();
if (m_protocol != 0)
{
m_protocol->clear ();
delete m_protocol;
m_protocol = 0;
}
@@ -1013,9 +1013,9 @@ Ipv4AddressTlvValue::Ipv4AddressTlvValue ()
Ipv4AddressTlvValue::~Ipv4AddressTlvValue ()
{
m_ipv4Addr->clear ();
if (m_ipv4Addr != 0)
{
m_ipv4Addr->clear ();
delete m_ipv4Addr;
m_ipv4Addr = 0;
}