Commit d0e50033 authored by Petri Latvala's avatar Petri Latvala

lib/aux: Plug memory leak in get_suspend_test

Free test_line in all paths out of the function.

v2: Avoid freeing too soon (Chris)
Signed-off-by: Petri Latvala's avatarPetri Latvala <petri.latvala@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
parent 72927ddd
......@@ -718,8 +718,10 @@ static enum igt_suspend_test get_suspend_test(int power_dir)
break;
}
if (!test_name)
if (!test_name) {
free(test_line);
return SUSPEND_TEST_NONE;
}
for (test = SUSPEND_TEST_NONE; test < SUSPEND_TEST_NUM; test++)
if (strcmp(suspend_test_name[test], test_name) == 0)
......@@ -728,7 +730,6 @@ static enum igt_suspend_test get_suspend_test(int power_dir)
igt_assert(test < SUSPEND_TEST_NUM);
free(test_line);
return test;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment