From: jared mauch Date: Thu, 12 Feb 2026 13:54:14 +0000 (+0000) Subject: testsuite: Fix memory leak in test_export_environ error paths X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=69c8cf976df0271b05af91e31d73621e3cfa2bc5;p=thirdparty%2Fkmod.git testsuite: Fix memory leak in test_export_environ error paths [emil: split from larger patch, commit message] Signed-off-by: Emil Velikov Reviewed-by: Lucas De Marchi Link: https://github.com/kmod-project/kmod/pull/423 Signed-off-by: Lucas De Marchi --- diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index 76690675..11a704f5 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -188,6 +188,7 @@ static void test_export_environ(const struct test *t) tmp = realloc(preload, preloadlen + 2 + ldpreloadlen); if (tmp == NULL) { ERR("oom: test_export_environ()\n"); + free(preload); return; } preload = tmp; @@ -208,6 +209,7 @@ static void test_export_environ(const struct test *t) tmp = malloc(preloadlen + 2 + len); if (tmp == NULL) { ERR("oom: test_export_environ()\n"); + free(preload); return; } memcpy(tmp, existing_preload, len);