Skip to contentSkip to conversation

drm/nouveau: add the missed kfree() for nouveau_bo_alloc()

PATCH New Jing Xiangfeng 1 participant 1 message Jul 15, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/nouveau: add the missed kfree() for nouveau_bo_alloc()

nouveau_bo_alloc() misses to call kfree() in an error path. Add the missed function call to fix it.

---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +3 -1
index c40f127de3d0..abd80b1a6de3 100644
@@ -276,8 +276,10 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 flags,
 			break;
 	}
 
-	if (WARN_ON(pi < 0))
+	if (WARN_ON(pi < 0)) {
+		kfree(nvbo);
 		return ERR_PTR(-EINVAL);
+	}
 
 	/* Disable compression if suitable settings couldn't be found. */
 	if (nvbo->comp && !vmm->page[pi].comp) {
Signature · 1 line
2.17.1