diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2019-04-18 17:32:19 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2019-04-19 21:09:50 +0200 |
commit | 6c4c3561fe07a0f388aba938643d8932450f8be1 (patch) | |
tree | c2dfe94051db85896f9ca87f7743704d31a96f8b /ripngd/ripng_offset.c | |
parent | Merge pull request #4165 from dslicenc/rnh-invalid-nexthops (diff) | |
download | frr-6c4c3561fe07a0f388aba938643d8932450f8be1.tar.xz frr-6c4c3561fe07a0f388aba938643d8932450f8be1.zip |
ripd, ripngd: fix cleaning up of offset lists
We should never attempt to remove a list item in the "del" callback
of the list. This is already performed by the list_delete() function,
doing it twice leads to crashes or memory corruption.
Introduce the offset_list_free() function so that we can separate the
removal and deallocation of offset lists into separate functions,
without code duplication. offset_list_del() will be used by the
northbound callbacks to remove offset lists, while offset_list_free()
will be used by rip_clean() to clean up all RIP offset lists using
list_delete(). Do the same for ripngd.
This is a fallout from the ripd/ripngd northbound conversion.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripngd/ripng_offset.c')
-rw-r--r-- | ripngd/ripng_offset.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ripngd/ripng_offset.c b/ripngd/ripng_offset.c index 41ba2360b..fe95ccfc2 100644 --- a/ripngd/ripng_offset.c +++ b/ripngd/ripng_offset.c @@ -56,6 +56,11 @@ struct ripng_offset_list *ripng_offset_list_new(struct ripng *ripng, void ripng_offset_list_del(struct ripng_offset_list *offset) { listnode_delete(offset->ripng->offset_list_master, offset); + ripng_offset_list_free(offset); +} + +void ripng_offset_list_free(struct ripng_offset_list *offset) +{ if (OFFSET_LIST_IN_NAME(offset)) free(OFFSET_LIST_IN_NAME(offset)); if (OFFSET_LIST_OUT_NAME(offset)) |