From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 3/3] lib/igt_kmod: Fix leaking subtest name
Date: Mon, 4 Nov 2024 21:52:55 -0800 [thread overview]
Message-ID: <20241105055255.2466236-4-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20241105055255.2466236-1-lucas.demarchi@intel.com>
Keep it simple, checking by !suite and then assigning subtest
accordingly. Since this is done only once, always call strdup()
and free().
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
lib/igt_kmod.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 58edac8fa..fb83f17c0 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -1199,7 +1199,7 @@ void igt_kunit(const char *module_name, const char *suite, const char *opts)
char debugfs_path[PATH_MAX] = { '\0', };
struct igt_ktest tst = { .kmsg = -1, };
struct igt_ktap_results *ktap = NULL;
- const char *subtest = suite;
+ char *subtest = NULL;
DIR *debugfs_dir = NULL;
IGT_LIST_HEAD(tests);
@@ -1208,7 +1208,7 @@ void igt_kunit(const char *module_name, const char *suite, const char *opts)
* we take the module name, drop the trailing "_test" or "_kunit"
* suffix, if any, and use the result as our IGT subtest name.
*/
- if (!subtest) {
+ if (!suite) {
subtest = strdup(module_name);
if (!igt_debug_on(!subtest)) {
char *suffix = strstr(subtest, "_test");
@@ -1216,6 +1216,8 @@ void igt_kunit(const char *module_name, const char *suite, const char *opts)
if (suffix)
*suffix = '\0';
}
+ } else {
+ subtest = strdup(suite);
}
/* We need the base KUnit module loaded if not built-in */
@@ -1262,6 +1264,7 @@ void igt_kunit(const char *module_name, const char *suite, const char *opts)
igt_ktest_end(&tst);
}
+ free(subtest);
igt_ktest_fini(&tst);
}
--
2.47.0
next prev parent reply other threads:[~2024-11-05 5:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 5:52 [PATCH i-g-t 0/3] lib/igt_kmod: Drop legacy kunit integration Lucas De Marchi
2024-11-05 5:52 ` [PATCH i-g-t 1/3] lib/igt_kmod: Drop legacy kunit fallback Lucas De Marchi
2024-11-05 10:40 ` Janusz Krzysztofik
2024-11-05 5:52 ` [PATCH i-g-t 2/3] lib/igt_kmod: Stop handling _kunit suffix Lucas De Marchi
2024-11-05 10:50 ` Janusz Krzysztofik
2024-11-05 14:58 ` Lucas De Marchi
2024-11-05 19:04 ` Janusz Krzysztofik
2024-11-05 5:52 ` Lucas De Marchi [this message]
2024-11-05 10:59 ` [PATCH i-g-t 3/3] lib/igt_kmod: Fix leaking subtest name Janusz Krzysztofik
2024-11-05 14:13 ` Lucas De Marchi
2024-11-05 8:17 ` ✓ Fi.CI.BAT: success for lib/igt_kmod: Drop legacy kunit integration (rev2) Patchwork
2024-11-05 8:31 ` ✓ CI.xeBAT: " Patchwork
2024-11-05 8:32 ` ✗ CI.xeBAT: failure " Patchwork
2024-11-06 1:24 ` ✗ Fi.CI.IGT: " Patchwork
2024-11-06 7:17 ` ✗ CI.xeFULL: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241105055255.2466236-4-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=janusz.krzysztofik@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox