summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2019-03-07 14:37:24 +0200
committerPetri Latvala <petri.latvala@intel.com>2019-03-08 13:30:08 +0200
commitd0e50033fd80abf5087804960ac66fb49d22de9d (patch)
treefc5e115994e2ebafcd0b455130bc8e4e050f7336 /lib/igt_aux.c
parent72927dddbf78638375ee029eef4be6c4b27e5d86 (diff)
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 <petri.latvala@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r--lib/igt_aux.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index e5d41e32..6eaf546e 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -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;
}