diff options
author | Eric Engestrom <[email protected]> | 2017-01-27 17:29:05 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-01-27 17:56:58 +0000 |
commit | 5f301fe2e681e72988f00d610a617a1c90c80b51 (patch) | |
tree | 5435b71922b0f8c9af1fc673ae439f45926a8b86 | |
parent | 1d104f9aa71aae1ef7c64f3a52dbfb1f62ddaa31 (diff) |
gbm/dri: fix memory leaks in error path
Signed-off-by: Eric Engestrom <[email protected]>
[Emil Velikov: make sure it builds]
Signed-off-by: Emil Velikov <[email protected]>
-rw-r--r-- | src/gbm/backends/dri/gbm_dri.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 45cb42a8625..ac7ede87b64 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -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; } |