Skip to content

Commit

Permalink
Dont create Fragment table for every soft reset
Browse files Browse the repository at this point in the history
Rightnow fragment table, which is a hash table, is created every time
soft reset is done by Agent, without  validating whether hashtable
already exists or not. This is resulting in memory leak as old hash
table is never deleted. As a fix, fragment table is created only if
it is non NULL

Change-Id: If54d997967da33cefc15b99efb5f7619bdf88132
closes-bug: #1675309
  • Loading branch information
divakardhar committed Mar 23, 2017
1 parent 1201a77 commit a87e668
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions dp-core/vr_fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,15 @@ vr_fragment_table_init(struct vrouter *router)
{
int ret;

router->vr_fragment_table = vr_htable_create(router,
FRAG_TABLE_ENTRIES, FRAG_OTABLE_ENTRIES,
sizeof(struct vr_fragment), sizeof(struct vr_fragment_key),
FRAG_TABLE_BUCKETS, vr_fragment_get_entry_key);
if (!router->vr_fragment_table) {
return vr_module_error(-ENOMEM, __FUNCTION__, __LINE__,
FRAG_TABLE_ENTRIES + FRAG_OTABLE_ENTRIES);
router->vr_fragment_table = vr_htable_create(router,
FRAG_TABLE_ENTRIES, FRAG_OTABLE_ENTRIES,
sizeof(struct vr_fragment), sizeof(struct vr_fragment_key),
FRAG_TABLE_BUCKETS, vr_fragment_get_entry_key);
if (!router->vr_fragment_table) {
return vr_module_error(-ENOMEM, __FUNCTION__, __LINE__,
FRAG_TABLE_ENTRIES + FRAG_OTABLE_ENTRIES);
}
}

if ((ret = vr_fragment_table_scanner_init(router)))
Expand Down

0 comments on commit a87e668

Please sign in to comment.