iris: fix BO destruction in error path

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4861>
(cherry picked from commit 604a86e46f)
This commit is contained in:
Lionel Landwerlin 2020-05-02 22:43:22 +03:00 committed by Eric Engestrom
parent 7f8305a2bf
commit be8f4197e1
2 changed files with 4 additions and 2 deletions

View file

@ -1453,7 +1453,7 @@
"description": "iris: fix BO destruction in error path",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -589,6 +589,7 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
void *ptr, size_t size,
enum iris_memory_zone memzone)
{
struct drm_gem_close close = { 0, };
struct iris_bo *bo;
bo = bo_calloc();
@ -634,7 +635,8 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
return bo;
err_close:
gen_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &bo->gem_handle);
close.handle = bo->gem_handle;
gen_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
err_free:
free(bo);
return NULL;