summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-11-26 12:12:53 -0500
committerChris Michael <cp.michael@samsung.com>2017-11-26 12:12:53 -0500
commit83c292ffc4b32d659a3a795d2f2711c9806cd1b3 (patch)
tree520f5228854a089fb92578ed85f0d7aca68fc28e
parent5abeeb980a9fb82136a70c24f822cdc3eb633dd0 (diff)
ecore-wl2: Fix resource leak
Coverity detected a resource leak here because we were not freeing the malloc'd 'obo' variable. Fixes Coverity CID1382907 Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_buffer.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_buffer.c b/src/lib/ecore_wl2/ecore_wl2_buffer.c
index a8e5bec..0403fd0 100644
--- a/src/lib/ecore_wl2/ecore_wl2_buffer.c
+++ b/src/lib/ecore_wl2/ecore_wl2_buffer.c
@@ -428,7 +428,12 @@ _vc4_alloc(Buffer_Manager *self EINA_UNUSED, const char *name EINA_UNUSED, int w
428 memset(&bo, 0, sizeof(bo)); 428 memset(&bo, 0, sizeof(bo));
429 bo.size = size; 429 bo.size = size;
430 ret = ioctl(drm_fd, DRM_IOCTL_VC4_CREATE_BO, &bo); 430 ret = ioctl(drm_fd, DRM_IOCTL_VC4_CREATE_BO, &bo);
431 if (ret) return NULL; 431 if (ret)
432 {
433 free(obo);
434 return NULL;
435 }
436
432 obo->handle = bo.handle; 437 obo->handle = bo.handle;
433 obo->size = size; 438 obo->size = size;
434 /* First try to allocate an mmapable buffer with O_RDWR, 439 /* First try to allocate an mmapable buffer with O_RDWR,
@@ -449,6 +454,7 @@ err:
449 memset(&cl, 0, sizeof(cl)); 454 memset(&cl, 0, sizeof(cl));
450 cl.handle = bo.handle; 455 cl.handle = bo.handle;
451 ioctl(drm_fd, DRM_IOCTL_GEM_CLOSE, &cl); 456 ioctl(drm_fd, DRM_IOCTL_GEM_CLOSE, &cl);
457 free(obo);
452 return NULL; 458 return NULL;
453} 459}
454 460