summaryrefslogtreecommitdiffstats
path: root/src/gbm
diff options
context:
space:
mode:
authorSiavash Eliasi <siavashserver@gmail.com>2014-02-10 13:28:15 +0330
committerKristian Høgsberg <krh@bitplanet.net>2014-02-28 15:57:15 -0800
commitf4416323fcbfdd8dec84e707b664ac1044dc14d3 (patch)
treed9dad767aa73b2271550170423966e41d0fbad78 /src/gbm
parent0fe8d71667b9ea4f4e115dce77f6f829e7681b8c (diff)
downloadexternal_mesa3d-f4416323fcbfdd8dec84e707b664ac1044dc14d3.zip
external_mesa3d-f4416323fcbfdd8dec84e707b664ac1044dc14d3.tar.gz
external_mesa3d-f4416323fcbfdd8dec84e707b664ac1044dc14d3.tar.bz2
gbm/dri: Fixed buffer object memory leak in case of failure.
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Diffstat (limited to 'src/gbm')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 5b9998f..acf6b24 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -611,7 +611,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
dri_format = __DRI_IMAGE_FORMAT_XRGB2101010;
break;
default:
- return NULL;
+ goto failed;
}
if (usage & GBM_BO_USE_SCANOUT)
@@ -628,7 +628,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
dri_format, dri_use,
bo);
if (bo->image == NULL)
- return NULL;
+ goto failed;
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE,
&bo->base.base.handle.s32);
@@ -636,6 +636,10 @@ gbm_dri_bo_create(struct gbm_device *gbm,
(int *) &bo->base.base.stride);
return &bo->base.base;
+
+failed:
+ free(bo);
+ return NULL;
}
static struct gbm_surface *