[igt-dev] [PATCH i-g-t 2/5] lib/aux: Plug memory leak in get_suspend_test

Petri Latvala petri.latvala at intel.com
Thu Mar 7 11:24:24 UTC 2019


Free test_line in all paths out of the function.

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
---
 lib/igt_aux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index e5d41e32..f4939bb5 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -718,6 +718,8 @@ static enum igt_suspend_test get_suspend_test(int power_dir)
 			break;
 		}
 
+	free(test_line);
+
 	if (!test_name)
 		return SUSPEND_TEST_NONE;
 
@@ -727,8 +729,6 @@ static enum igt_suspend_test get_suspend_test(int power_dir)
 
 	igt_assert(test < SUSPEND_TEST_NUM);
 
-	free(test_line);
-
 	return test;
 }
 
-- 
2.19.1



More information about the igt-dev mailing list