automated: linux: modules: clear kmemleak state before testing each module

Add kmemleak state clearing before testing each module to ensure clean
starting conditions and prevent false attribution of leaks between modules.

This ensures that:
- Each module starts with a clean kmemleak state
- Leaks detected are attributed to the correct module being tested
- No cross-contamination between different module tests occurs
- Previous module leaks don't affect subsequent module test results

The clearing is only performed when kmemleak is available, maintaining
compatibility with systems that don't have kmemleak support.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
diff --git a/automated/linux/modules/modules.sh b/automated/linux/modules/modules.sh
index 63fead8..c307aa1 100755
--- a/automated/linux/modules/modules.sh
+++ b/automated/linux/modules/modules.sh
@@ -164,6 +164,11 @@
 	for module in ${MODULES_LIST}; do
 		# don't insert/remove modules that is already inserted.
 		if ! lsmod | grep "^${module}"; then
+			# Clear kmemleak state before testing this module
+			if [ -e /sys/kernel/debug/kmemleak ]; then
+				echo clear > /sys/kernel/debug/kmemleak
+			fi
+
 			# Record memory at start of all iterations
 			mem_start=$(get_mem_usage_kb)