[Intel-gfx] [PATCH][next] drm/i915/selftests: fix memory leak of 'spin'

Colin King colin.king at canonical.com
Tue Feb 19 15:01:29 UTC 2019


From: Colin Ian King <colin.king at canonical.com>

There is a memory leak of 'spin' on an error return path. Fix this by
kfree'ing spin before the return.

Fixes: c06ee6ff2cbc ("drm/i915/selftests: Context SSEU reconfiguration tests")
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 drivers/gpu/drm/i915/selftests/i915_gem_context.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
index d00d0bb07784..cf988797bb17 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
@@ -725,8 +725,10 @@ __sseu_prepare(struct drm_i915_private *i915,
 		}
 
 		ret = igt_spinner_init(spin, i915);
-		if (ret)
+		if (ret) {
+			kfree(spin);
 			return ret;
+		}
 
 		rq = igt_spinner_create_request(spin, ctx, engine, MI_NOOP);
 		if (IS_ERR(rq)) {
-- 
2.20.1



More information about the Intel-gfx mailing list