Commit 806fd6d0 authored by Danilo Krummrich's avatar Danilo Krummrich Committed by Christian König

drm/test: drm_exec: fix memory leak on object prepare

drm_exec_prepare_obj() and drm_exec_prepare_array() both reserve
dma-fence slots and hence a dma_resv_list without ever freeing it.

Make sure to call drm_gem_private_object_fini() for each GEM object
passed to drm_exec_prepare_obj()/drm_exec_prepare_array() throughout the
test to fix this up.

While at it, remove some trailing empty lines.

Fixes: 9710631c ("drm: add drm_exec selftests v4")
Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230809225034.8803-1-dakr@redhat.comSigned-off-by: default avatarChristian König <christian.koenig@amd.com>
parent d01cb045
...@@ -125,8 +125,6 @@ static void test_duplicates(struct kunit *test) ...@@ -125,8 +125,6 @@ static void test_duplicates(struct kunit *test)
drm_exec_fini(&exec); drm_exec_fini(&exec);
} }
static void test_prepare(struct kunit *test) static void test_prepare(struct kunit *test)
{ {
struct drm_exec_priv *priv = test->priv; struct drm_exec_priv *priv = test->priv;
...@@ -145,6 +143,8 @@ static void test_prepare(struct kunit *test) ...@@ -145,6 +143,8 @@ static void test_prepare(struct kunit *test)
break; break;
} }
drm_exec_fini(&exec); drm_exec_fini(&exec);
drm_gem_private_object_fini(&gobj);
} }
static void test_prepare_array(struct kunit *test) static void test_prepare_array(struct kunit *test)
...@@ -165,6 +165,9 @@ static void test_prepare_array(struct kunit *test) ...@@ -165,6 +165,9 @@ static void test_prepare_array(struct kunit *test)
1); 1);
KUNIT_EXPECT_EQ(test, ret, 0); KUNIT_EXPECT_EQ(test, ret, 0);
drm_exec_fini(&exec); drm_exec_fini(&exec);
drm_gem_private_object_fini(&gobj1);
drm_gem_private_object_fini(&gobj2);
} }
static void test_multiple_loops(struct kunit *test) static void test_multiple_loops(struct kunit *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