From 70c32043a53cac5bb1eb96e4ef5947e63a6eb405 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Wed, 22 Jul 2020 14:52:48 -0700 Subject: [PATCH] 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 --- ts2phc_slave.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ts2phc_slave.c b/ts2phc_slave.c index 22d00cd..71077a7 100644 --- a/ts2phc_slave.c +++ b/ts2phc_slave.c @@ -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);