From 949f896badc4cefd2bdadaa076253de0ab16238c Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Sat, 6 Jul 2019 19:31:36 +0200 Subject: [PATCH] tests: fix a memory leak in exit path When exiting normally we free all allocated resources (mostly to keep valgrind quiet). The toolpath string is not being freed and pops up in valgrind's "still reachable" category of leaks. Free this memory too in the atexit() cleanup callback. Signed-off-by: Bartosz Golaszewski --- tests/gpiod-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/gpiod-test.c b/tests/gpiod-test.c index 621d837..82e23ea 100644 --- a/tests/gpiod-test.c +++ b/tests/gpiod-test.c @@ -311,6 +311,8 @@ static void cleanup_func(void) msg("cleaning up"); free(globals.pipebuf); + if (globals.toolpath) + free(globals.toolpath); gpio_mockup_unref(globals.mockup); } -- 2.30.2