diff options
author | Ido Barnea <ibarnea@cisco.com> | 2016-06-14 18:12:00 +0300 |
---|---|---|
committer | Ido Barnea <ibarnea@cisco.com> | 2016-06-14 18:12:00 +0300 |
commit | f10425988270f142de60ff02c61cb8d77b9ac03e (patch) | |
tree | b3f526766d9b4470ff0db6f26ad7ac03a7a68d9d /src/flow_stat.cpp | |
parent | 14774ed2eabf8a6f218e8674a04ee7d8ce373d64 (diff) |
coverity fixes
Diffstat (limited to 'src/flow_stat.cpp')
-rw-r--r-- | src/flow_stat.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/flow_stat.cpp b/src/flow_stat.cpp index 98b9494b..71d3a74a 100644 --- a/src/flow_stat.cpp +++ b/src/flow_stat.cpp @@ -227,7 +227,7 @@ CFlowStatUserIdMap::add_user_id(uint32_t user_id, uint8_t proto) { << std::endl; #endif - CFlowStatUserIdInfo *new_id = new CFlowStatUserIdInfo(proto); + CFlowStatUserIdInfo *new_id; if (proto == PAYLOAD_RULE_PROTO) { new_id = new CFlowStatUserIdInfoPayload(proto); @@ -390,7 +390,8 @@ uint16_t CFlowStatUserIdMap::unmap(uint32_t user_id) { /************** class CFlowStatHwIdMap ***************/ CFlowStatHwIdMap::CFlowStatHwIdMap() { - m_map = NULL; + m_map = NULL; // must call create in order to work with the class + m_num_free = 0; // to make coverity happy, init this here too. } CFlowStatHwIdMap::~CFlowStatHwIdMap() { @@ -466,6 +467,7 @@ CFlowStatRuleMgr::CFlowStatRuleMgr() { m_hw_id_map_payload.create(MAX_FLOW_STATS_PAYLOAD); memset(m_rx_cant_count_err, 0, sizeof(m_rx_cant_count_err)); memset(m_tx_cant_count_err, 0, sizeof(m_tx_cant_count_err)); + m_num_ports = 0; // need to call create to init } CFlowStatRuleMgr::~CFlowStatRuleMgr() { @@ -480,7 +482,7 @@ void CFlowStatRuleMgr::create() { m_api = tstateless->get_platform_api(); assert(m_api); m_api->get_interface_stat_info(0, num_counters, cap); - m_api->get_port_num(m_num_ports); + m_api->get_port_num(m_num_ports); // This initialize m_num_ports for (uint8_t port = 0; port < m_num_ports; port++) { assert(m_api->reset_hw_flow_stats(port) == 0); } |