]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite/test-remove: plug memory leaks in success path
authorEmil Velikov <emil.l.velikov@gmail.com>
Fri, 13 Jun 2025 19:12:28 +0000 (20:12 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Mon, 16 Jun 2025 12:37:42 +0000 (07:37 -0500)
With the upcoming patches, removing exit() usage, ASan started reporting
that our test leaks kmod_module handles.

Resolve those leaks - we shouldn't be doing that in the normal (success)
path.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
testsuite/test-remove.c

index 1cf47d8e5f757b10e3a380c5092cfc6122b2b623..ed5cc31e0ef019ed83ba936bc8efe07758e7fd45 100644 (file)
@@ -51,6 +51,7 @@ static noreturn int test_remove(void)
                ERR("could not remove module directory.\n");
                exit(EXIT_FAILURE);
        }
+       kmod_module_unref(mod);
        kmod_unref(ctx);
 
        exit(EXIT_SUCCESS);