Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915: Fix memory leaks in function live_nop_switch
@ 2023-05-08  8:50 Cong Liu
  2023-05-08 14:43 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Cong Liu @ 2023-05-08  8:50 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Daniel Vetter
  Cc: intel-gfx, Cong Liu, linux-kernel, dri-devel

Be sure to properly free the allocated memory before exiting
the live_nop_switch function.

Signed-off-by: Cong Liu <liucong2@kylinos.cn>
---
 drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
index a81fa6a20f5a..54eddbe7f510 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
@@ -59,7 +59,8 @@ static int live_nop_switch(void *arg)
 	ctx = kcalloc(nctx, sizeof(*ctx), GFP_KERNEL);
 	if (!ctx) {
 		err = -ENOMEM;
-		goto out_file;
+		fput(file);
+		return err;
 	}
 
 	for (n = 0; n < nctx; n++) {
@@ -175,6 +176,7 @@ static int live_nop_switch(void *arg)
 
 out_file:
 	fput(file);
+	kfree(ctx);
 	return err;
 }
 
-- 
2.34.1


No virus found
		Checked by Hillstone Network AntiVirus

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-19 21:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-08  8:50 [Intel-gfx] [PATCH] drm/i915: Fix memory leaks in function live_nop_switch Cong Liu
2023-05-08 14:43 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2023-05-08 16:08 ` [Intel-gfx] [PATCH] " Rodrigo Vivi
2023-05-08 16:35 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Fix memory leaks in function live_nop_switch (rev2) Patchwork
2023-05-17  5:02 ` [Intel-gfx] [PATCH v2] drm/i915: Fix memory leaks in function live_nop_switch Cong Liu
2023-05-19 21:09   ` Rodrigo Vivi
2023-05-19 15:30 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Fix memory leaks in function live_nop_switch (rev3) Patchwork
2023-05-19 17:10 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox