diff options
| author | Rafael Zalamena <rzalamena@users.noreply.github.com> | 2018-09-24 17:45:20 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-24 17:45:20 -0300 |
| commit | caca1bff127d8c3e9e9d5cdcc9335c4051a8b061 (patch) | |
| tree | 4a088a924066fcd110ef108c62d8178e63960064 | |
| parent | a1b32de24ed520a53499f6e81d6ee8eaac548bd1 (diff) | |
| parent | 1d48383802af98683d6d92e3d7c143b830340673 (diff) | |
Merge pull request #3082 from donaldsharp/memory
pimd: Fix several address sanitizer issues
| -rw-r--r-- | pimd/pim_instance.c | 4 | ||||
| -rw-r--r-- | pimd/pim_upstream.c | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c index bf8d05d1e1..c592a2c047 100644 --- a/pimd/pim_instance.c +++ b/pimd/pim_instance.c @@ -44,10 +44,10 @@ static void pim_instance_terminate(struct pim_instance *pim) if (pim->static_routes) list_delete_and_null(&pim->static_routes); - pim_rp_free(pim); - pim_upstream_terminate(pim); + pim_rp_free(pim); + /* Traverse and cleanup rpf_hash */ if (pim->rpf_hash) { hash_clean(pim->rpf_hash, (void *)pim_rp_list_hash_clean); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 0728c9490b..4adfde6775 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -1534,12 +1534,13 @@ unsigned int pim_upstream_hash_key(void *arg) void pim_upstream_terminate(struct pim_instance *pim) { - struct listnode *node, *nnode; struct pim_upstream *up; if (pim->upstream_list) { - for (ALL_LIST_ELEMENTS(pim->upstream_list, node, nnode, up)) + while (pim->upstream_list->count) { + up = listnode_head(pim->upstream_list); pim_upstream_del(pim, up, __PRETTY_FUNCTION__); + } list_delete_and_null(&pim->upstream_list); } |
