From c00889f9eb8e1658d45d7cf959c20b47086d7933 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Thu, 26 Dec 2013 19:09:26 +0100 Subject: [PATCH] Fix filter allocation failure on the UDS port. Although it does not need to, the UDS port tries to allocate a filter, just as any normal port would. Since the given length is zero, the filter tries to allocate storage of size zero. When running with uClibc, calloc(1, 0) returns NULL, but glibc is apparently returning "a unique pointer value that can later be successfully passed to free()." Both behaviors are allowed (see MALLOC(3)). This patch works around the issue by letting the UDS port have a filter of length one. Signed-off-by: Richard Cochran --- clock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/clock.c b/clock.c index cd8774c..30a3ffc 100644 --- a/clock.c +++ b/clock.c @@ -583,6 +583,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count, memset(&udsif, 0, sizeof(udsif)); snprintf(udsif.name, sizeof(udsif.name), "%s", uds_path); udsif.transport = TRANS_UDS; + udsif.delay_filter_length = 1; clock_gettime(CLOCK_REALTIME, &ts); srandom(ts.tv_sec ^ ts.tv_nsec);