]> git.puffer.fish Git - mirror/frr.git/commit
sharpd: Fix memory leak in release-locator-chunk
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Tue, 23 Aug 2022 22:25:17 +0000 (00:25 +0200)
committerCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Wed, 24 Aug 2022 12:22:04 +0000 (14:22 +0200)
commita0c47583a43138f32cf4c1a3691c289d46ba2933
tree7b1307c6698ff286c1ae3c0c2647983e842c41e7
parentf8e9c702a17d6b5642078305436ad9b8920a119a
sharpd: Fix memory leak in release-locator-chunk

Running the `zebra_seg6local_route` topotest with `--valgrind-memleaks`
gives several memory leak errors. This is due to the way SRv6 chunks are
released: when the user executes the CLI command
`sharp srv6-manager release-locator-chunk` to release the chunks of an
SRv6 locator, all the chunks are removed from the list `loc->chunks`.
Also, the locator is removed from the SRv6 locators list
`sg.srv6_locators`, but the memory allocated for the locator is not
freed.

This patch adds a call to `XFREE()` to properly free the allocated
memory when all the chunks of an SRv6 locator are removed and the
locator is removed as well.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
sharpd/sharp_vty.c