From: Changyeon Lee Date: Tue, 2 Jun 2015 11:34:49 +0000 (+0900) Subject: Fix prevent issues X-Git-Tag: accepted/tizen/mobile/20150715.003250~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F43693%2F1;p=archive%2Fplatform%2Fadaptation%2Fsamsung_exynos%2Flibtbm-exynos4412.git Fix prevent issues Change-Id: I0995981a685ef5a140380afbb70bd56f0c26c26f --- diff --git a/src/tbm_bufmgr_exynos4412.c b/src/tbm_bufmgr_exynos4412.c index 91487d4..f77c42a 100755 --- a/src/tbm_bufmgr_exynos4412.c +++ b/src/tbm_bufmgr_exynos4412.c @@ -490,6 +490,15 @@ tbm_exynos4412_bo_alloc (tbm_bo bo, int size, int flags) /* add bo to hash */ PrivGem* privGem = calloc (1, sizeof(PrivGem)); + if (!privGem) + { + TBM_EXYNOS4412_LOG ("[libtbm-exynos4412:%d] " + "error %s:%d Fail to calloc privGem\n", + getpid(), __FUNCTION__, __LINE__); + free (bo_exynos4412); + return 0; + } + privGem->ref_count = 1; if (drmHashInsert(bufmgr_exynos4412->hashBos, bo_exynos4412->name, (void *)privGem) < 0) { @@ -647,6 +656,15 @@ tbm_exynos4412_bo_import (tbm_bo bo, unsigned int key) else if (ret == 1) { privGem = calloc (1, sizeof(PrivGem)); + if (!privGem) + { + TBM_EXYNOS4412_LOG ("[libtbm-exynos4412:%d] " + "error %s:%d Fail to calloc privGem\n", + getpid(), __FUNCTION__, __LINE__); + free (bo_exynos4412); + return 0; + } + privGem->ref_count = 1; if (drmHashInsert (bufmgr_exynos4412->hashBos, bo_exynos4412->name, (void *)privGem) < 0) { @@ -735,6 +753,7 @@ tbm_exynos4412_bo_import_fd (tbm_bo bo, tbm_fd key) { TBM_EXYNOS4412_LOG ("error bo:%p Cannot get name from gem:%d, fd:%d (%s)\n", bo, gem, key, strerror(errno)); + free (bo_exynos4412); return 0; } @@ -750,6 +769,15 @@ tbm_exynos4412_bo_import_fd (tbm_bo bo, tbm_fd key) else if (ret == 1) { privGem = calloc (1, sizeof(PrivGem)); + if (!privGem) + { + TBM_EXYNOS4412_LOG ("[libtbm-exynos4412:%d] " + "error %s:%d Fail to calloc privGem\n", + getpid(), __FUNCTION__, __LINE__); + free (bo_exynos4412); + return 0; + } + privGem->ref_count = 1; if (drmHashInsert (bufmgr_exynos4412->hashBos, bo_exynos4412->name, (void *)privGem) < 0) {