Drop the reference to best when freeing the foreign masters.
This fixes the following issue reported by valgrind, which occurs after a port disable/initialize subsequent to having entered slave mode. ==10651== Invalid read of size 4 ==10651== at 0x804E6E2: fc_clear (port.c:175) ==10651== by 0x805132F: port_event (port.c:1352) ==10651== by 0x804B383: clock_poll (clock.c:597) ==10651== by 0x80498AE: main (ptp4l.c:278) ==10651== Address 0x41cba60 is 16 bytes inside a block of size 60 free'd ==10651== at 0x4023B6A: free (vg_replace_malloc.c:366) ==10651== by 0x804EB09: free_foreign_masters (port.c:287) ==10651== by 0x804FB14: port_disable (port.c:722) ==10651== by 0x8051228: port_dispatch (port.c:1298) ==10651== by 0x804B3C6: clock_poll (clock.c:602) ==10651== by 0x80498AE: main (ptp4l.c:278) Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
2040933d74
commit
852d587fd3
1
port.c
1
port.c
|
@ -719,6 +719,7 @@ static void port_disable(struct port *p)
|
||||||
p->peer_delay_fup = NULL;
|
p->peer_delay_fup = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->best = NULL;
|
||||||
free_foreign_masters(p);
|
free_foreign_masters(p);
|
||||||
clock_remove_fda(p->clock, p, p->fda);
|
clock_remove_fda(p->clock, p, p->fda);
|
||||||
transport_close(p->trp, &p->fda);
|
transport_close(p->trp, &p->fda);
|
||||||
|
|
Loading…
Reference in New Issue