From a0191b65e43b9a2ba48eb98fc730b390a699a7d2 Mon Sep 17 00:00:00 2001 From: Sejun Park Date: Tue, 3 Apr 2018 17:25:52 +0900 Subject: [PATCH] fixed coverity issues Change-Id: Ieaaeabe72e5d97974909bca9bc30b86e0c6f24d9 --- exynos4/libcodec/video/v4l2/dec/ExynosVideoDecoder.c | 16 ++++++---------- exynos4/libcodec/video/v4l2/enc/ExynosVideoEncoder.c | 16 ++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/exynos4/libcodec/video/v4l2/dec/ExynosVideoDecoder.c b/exynos4/libcodec/video/v4l2/dec/ExynosVideoDecoder.c index 24be448..8adb7be 100755 --- a/exynos4/libcodec/video/v4l2/dec/ExynosVideoDecoder.c +++ b/exynos4/libcodec/video/v4l2/dec/ExynosVideoDecoder.c @@ -151,27 +151,23 @@ static void *MFC_Decoder_Init(int nMemoryType) pCtx->nMemoryType = nMemoryType; - pMutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - if (pMutex == NULL) { + pCtx->pInMutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); + if (pCtx->pInMutex == NULL) { ALOGE("%s: Failed to allocate mutex about input buffer", __func__); goto EXIT_QUERYCAP_FAIL; } - if (pthread_mutex_init(pMutex, NULL) != 0) { - free(pMutex); + if (pthread_mutex_init(pCtx->pInMutex, NULL) != 0) { goto EXIT_QUERYCAP_FAIL; } - pCtx->pInMutex = (void*)pMutex; - pMutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - if (pMutex == NULL) { + pCtx->pOutMutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); + if (pCtx->pOutMutex == NULL) { ALOGE("%s: Failed to allocate mutex about output buffer", __func__); goto EXIT_QUERYCAP_FAIL; } - if (pthread_mutex_init(pMutex, NULL) != 0) { - free(pMutex); + if (pthread_mutex_init(pCtx->pOutMutex, NULL) != 0) { goto EXIT_QUERYCAP_FAIL; } - pCtx->pOutMutex = (void*)pMutex; return (void *)pCtx; diff --git a/exynos4/libcodec/video/v4l2/enc/ExynosVideoEncoder.c b/exynos4/libcodec/video/v4l2/enc/ExynosVideoEncoder.c index 2851560..0469587 100755 --- a/exynos4/libcodec/video/v4l2/enc/ExynosVideoEncoder.c +++ b/exynos4/libcodec/video/v4l2/enc/ExynosVideoEncoder.c @@ -161,27 +161,23 @@ static void *MFC_Encoder_Init(int nMemoryType) pCtx->nMemoryType = nMemoryType; - pMutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - if (pMutex == NULL) { + pCtx->pInMutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); + if (pCtx->pInMutex == NULL) { ALOGE("%s: Failed to allocate mutex about input buffer", __func__); goto EXIT_QUERYCAP_FAIL; } - if (pthread_mutex_init(pMutex, NULL) != 0) { - free(pMutex); + if (pthread_mutex_init(pCtx->pInMutex, NULL) != 0) { goto EXIT_QUERYCAP_FAIL; } - pCtx->pInMutex = (void*)pMutex; - pMutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - if (pMutex == NULL) { + pCtx->pOutMutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); + if (pCtx->pOutMutex == NULL) { ALOGE("%s: Failed to allocate mutex about output buffer", __func__); goto EXIT_QUERYCAP_FAIL; } - if (pthread_mutex_init(pMutex, NULL) != 0) { - free(pMutex); + if (pthread_mutex_init(pCtx->pOutMutex, NULL) != 0) { goto EXIT_QUERYCAP_FAIL; } - pCtx->pOutMutex = (void*)pMutex; return (void *)pCtx; -- 2.7.4