Skip to content

Commit

Permalink
[drouting] bug fix and memory leak fix
Browse files Browse the repository at this point in the history
* free gateways list for each carrier at reload
* use map_find instead of map_get to search an element in the tree
  • Loading branch information
ionutrazvanionita committed Apr 29, 2016
1 parent dc9e068 commit a2522eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions modules/drouting/prefix_tree.c
Expand Up @@ -214,7 +214,8 @@ get_gw_by_id(
str *id
)
{
return (pgw_t *)*map_get(pgw_tree, *id);
pgw_t** ret;
return (ret=(pgw_t**)map_find(pgw_tree, *id))?*ret:NULL;
}

pcr_t*
Expand All @@ -223,7 +224,9 @@ get_carrier_by_id(
str *id
)
{
return (pcr_t*)*map_get(carriers_tree, *id);
pcr_t** ret;

return (ret=(pcr_t**)map_find(carriers_tree, *id))?*ret:NULL;
}


Expand Down
4 changes: 3 additions & 1 deletion modules/drouting/routing.c
Expand Up @@ -630,7 +630,9 @@ void destroy_pgw(void *pgw_p)

void destroy_pcr(void *pcr_p)
{
shm_free((pcr_t *)pcr_p);
pcr_t* pcr = pcr_p;
if (pcr->pgwl) shm_free(pcr->pgwl);
shm_free(pcr);
}


Expand Down

0 comments on commit a2522eb

Please sign in to comment.