From: Bartosz Golaszewski Date: Sat, 6 Jul 2019 17:31:36 +0000 (+0200) Subject: tests: fix a memory leak in exit path X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=949f896badc4cefd2bdadaa076253de0ab16238c;p=qemu-gpiodev%2Flibgpiod.git 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 --- 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); }