Skip to contentSkip to conversation

test_kmod: fix small memory leak on filesystem tests

PATCH New [email protected] 1 participant 1 message Aug 10, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 7/21 test_kmod: fix small memory leak on filesystem tests

From: Dan Carpenter <[email protected]>
Subject: test_kmod: fix small memory leak on filesystem tests

The break was in the wrong place so file system tests don't work as intended, leaking memory at each test switch.

[[email protected]: massaged commit subject, noted memory leak issue without the fix]
Fixes 39258f448d71 ("kmod: add test driver to stress test the module loader")
Cc Colin Ian King <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Eric W. Biederman <[email protected]>
Cc Jessica Yu <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Kees Cook <[email protected]>
Cc Michal Marek <[email protected]>
Cc Miroslav Benes <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Shuah Khan <[email protected]>

---

 lib/test_kmod.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_kmod.c renamed from lib/test_kmod.c~test_kmod-fix-small-memory-leak-on-filesystem-tests +1 -1
diff -puN lib/test_kmod.c~test_kmod-fix-small-memory-leak-on-filesystem-tests lib/test_kmod.c
@@ -746,11 +746,11 @@ static int trigger_config_run_type(struc
 						      strlen(test_str));
 		break;
 	case TEST_KMOD_FS_TYPE:
-		break;
 		kfree_const(config->test_fs);
 		config->test_driver = NULL;
 		copied = config_copy_test_fs(config, test_str,
 					     strlen(test_str));
+		break;
 	default:
 		mutex_unlock(&test_dev->config_mutex);
 		return -EINVAL;

_