mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 09:00:10 +01:00
gbm/dri: fix memory leaks in error path
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> [Emil Velikov: make sure it builds] Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
parent
1d104f9aa7
commit
5f301fe2e6
1 changed files with 6 additions and 1 deletions
|
|
@ -695,6 +695,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
|
|||
gbm_format = GBM_FORMAT_YUYV;
|
||||
break;
|
||||
default:
|
||||
dri->image->destroyImage(image);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
|
|
@ -715,6 +716,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
|
|||
gbm_format = gbm_dri_to_gbm_format(dri_format);
|
||||
if (gbm_format == 0) {
|
||||
errno = EINVAL;
|
||||
dri->image->destroyImage(image);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
|
|
@ -759,8 +761,10 @@ gbm_dri_bo_import(struct gbm_device *gbm,
|
|||
|
||||
|
||||
bo = calloc(1, sizeof *bo);
|
||||
if (bo == NULL)
|
||||
if (bo == NULL) {
|
||||
dri->image->destroyImage(image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bo->image = image;
|
||||
|
||||
|
|
@ -771,6 +775,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
|
|||
if (dri->image->base.version >= 2 &&
|
||||
!dri->image->validateUsage(bo->image, dri_use)) {
|
||||
errno = EINVAL;
|
||||
dri->image->destroyImage(bo->image);
|
||||
free(bo);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue