Merge "IPACM: fix memory leak issue"
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 0678acf..86587bd 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -969,7 +969,7 @@
{
/* add default WAN route */
- struct ipa_ioc_add_rt_rule *rt_rule;
+ struct ipa_ioc_add_rt_rule *rt_rule = NULL;
struct ipa_rt_rule_add *rt_rule_entry;
struct ipa_ioc_get_hdr sRetHeader;
uint32_t cnt, tx_index = 0;
@@ -1237,6 +1237,7 @@
if (wanup_data == NULL)
{
IPACMERR("Unable to allocate memory\n");
+ free(rt_rule);
return IPACM_FAILURE;
}
memset(wanup_data, 0, sizeof(ipacm_event_iface_up));
@@ -1313,6 +1314,10 @@
IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
IPACM_Iface::ipacmcfg->AddRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe],false);
+ if(rt_rule != NULL)
+ {
+ free(rt_rule);
+ }
return IPACM_SUCCESS;
}
@@ -4243,7 +4248,8 @@
if(0 != ioctl(m_fd_ipa, IPA_IOC_GENERATE_FLT_EQ, &flt_eq))
{
IPACMERR("Failed to get eq_attrib\n");
- return IPACM_FAILURE;
+ res = IPACM_FAILURE;
+ goto fail;
}
memcpy(&flt_rule_entry.rule.eq_attrib,
&flt_eq.eq_attrib,
@@ -4275,8 +4281,8 @@
if(ioctl(m_fd_ipa, IPA_IOC_QUERY_RT_TBL_INDEX, &rt_tbl_idx) < 0)
{
IPACMERR("Failed to get routing table index from name\n");
- free(pFilteringTable_v4);
- return IPACM_FAILURE;
+ res = IPACM_FAILURE;
+ goto fail;
}
IPACMDBG_H("Routing table %s has index %d\n", rt_tbl_idx.name, rt_tbl_idx.idx);
@@ -4298,7 +4304,8 @@
if(0 != ioctl(m_fd_ipa, IPA_IOC_GENERATE_FLT_EQ, &flt_eq))
{
IPACMERR("Failed to get eq_attrib\n");
- return IPACM_FAILURE;
+ res = IPACM_FAILURE;
+ goto fail;
}
memcpy(&flt_rule_entry.rule.eq_attrib,
&flt_eq.eq_attrib,