diff mbox series

drm/nouveau/nvif: avoid possible memory leak of 'args'

Message ID 20231025051922.525940-1-suhui@nfschina.com (mailing list archive)
State New, archived
Headers show
Series drm/nouveau/nvif: avoid possible memory leak of 'args' | expand

Commit Message

Su Hui Oct. 25, 2023, 5:19 a.m. UTC
Use kfree() to free 'args' before return '-EINVAL'.

Signed-off-by: Su Hui <suhui@nfschina.com>
---
 drivers/gpu/drm/nouveau/nvif/vmm.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nvif/vmm.c b/drivers/gpu/drm/nouveau/nvif/vmm.c
index 99296f03371a..a0afe3bf0d78 100644
--- a/drivers/gpu/drm/nouveau/nvif/vmm.c
+++ b/drivers/gpu/drm/nouveau/nvif/vmm.c
@@ -219,6 +219,7 @@  nvif_vmm_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass,
 	case RAW: args->type = NVIF_VMM_V0_TYPE_RAW; break;
 	default:
 		WARN_ON(1);
+		kfree(args);
 		return -EINVAL;
 	}