From cea7fe9efa4f629ebb2395a8083029d15f595a3e Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Mon, 30 May 2022 23:46:02 +0000 Subject: [PATCH] nouveau(4): Fix error branches in nouveau_gem_new. PR kern/56804 --- sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c index 1132c087d6f0..d354b711e426 100644 --- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c +++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c @@ -202,13 +202,13 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain, * to the caller, instead of a normal nouveau_bo ttm reference. */ ret = drm_gem_object_init(drm->dev, &nvbo->bo.base, size); if (ret) { - nouveau_bo_ref(NULL, &nvbo); + kfree(nvbo); return ret; } ret = nouveau_bo_init(nvbo, size, align, flags, NULL, NULL); if (ret) { - nouveau_bo_ref(NULL, &nvbo); + /* XXX note: if this fails it kfrees nvbo */ return ret; }