ts2phc: Fix memory leak.

Each slave creates an instance of a servo.  However, when cleaning up, the
code neglected to free the servo, resulting in a memory leak.  This patch
fixes the issue by calling the appropriate method to destroy the servo.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2020-07-22 14:52:48 -07:00
parent 278d9f45ab
commit 70c32043a5
1 changed files with 1 additions and 0 deletions

View File

@ -240,6 +240,7 @@ static void ts2phc_slave_destroy(struct ts2phc_slave *slave)
if (ioctl(slave->fd, PTP_EXTTS_REQUEST2, &extts)) {
pr_err(PTP_EXTTS_REQUEST_FAILED);
}
servo_destroy(slave->servo);
posix_clock_close(slave->clk);
free(slave->name);
free(slave);