]> git.ipfire.org Git - thirdparty/lldpd.git/commit
lib: fix a segfault introduced in ef3707 when freeing an atom
authorVincent Bernat <bernat@luffy.cx>
Sat, 12 Oct 2013 15:29:26 +0000 (17:29 +0200)
committerVincent Bernat <bernat@luffy.cx>
Sat, 12 Oct 2013 15:29:26 +0000 (17:29 +0200)
commit4e97a0bf8488204cdaf6a107d433e042f91dad24
treeca3d69a6db028c85f3d337fed32e707a1a46f005
parent00e40dba232cf4f9c1943cea01147fb688e94e5e
lib: fix a segfault introduced in ef3707 when freeing an atom

In the change "lldpd: make notifications work when a port goes down",
a regression was introduced. It is important to never call
`TAILQ_REMOVE` on a marshalled struct, like when we are in
liblldpctl. This is because the marshalling process does not keep a
real list (prev pointer is incorrect).

The change ef3707 did introduce a regression by calling TAILQ_REMOVE
in a case where it is useless. We only need to call TAILQ_REMOVE if we
won't empty the whole list. So when we call `lldpd_remote_cleanup()`
with `all` set to `1`, we don't need to call TAILQ_REMOVE.
src/lldpd-structs.c