diff options
author | Sejun Park <sejun79.park@samsung.com> | 2018-03-22 12:47:20 +0900 |
---|---|---|
committer | Sejun Park <sejun79.park@samsung.com> | 2018-03-22 12:47:34 +0900 |
commit | 5cbf74bc0c94a50da2d981e72216593ed7bba41c (patch) | |
tree | 5571e4c497e28e45c1c0e1de6f1395b5f716c04c | |
parent | 22cb54da9d3132dac7215f2ad296b99a7a7c08ff (diff) | |
download | libomxil-e3250-v4l2-5cbf74bc0c94a50da2d981e72216593ed7bba41c.tar.gz libomxil-e3250-v4l2-5cbf74bc0c94a50da2d981e72216593ed7bba41c.tar.bz2 libomxil-e3250-v4l2-5cbf74bc0c94a50da2d981e72216593ed7bba41c.zip |
fixed svace issues
Change-Id: I6d836dc0a0ec8e58645144b4f41ff2d4e45608fb
4 files changed, 22 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; diff --git a/openmax/component/video/enc/h264/Exynos_OMX_H264enc.c b/openmax/component/video/enc/h264/Exynos_OMX_H264enc.c index e3eb799..41cd3f2 100755 --- a/openmax/component/video/enc/h264/Exynos_OMX_H264enc.c +++ b/openmax/component/video/enc/h264/Exynos_OMX_H264enc.c @@ -1023,6 +1023,11 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) pVideoEnc->pMFCEncOutputBuffer[i] = (CODEC_ENC_BUFFER *)Exynos_OSAL_Malloc(sizeof(CODEC_ENC_BUFFER)); + if (!pVideoEnc->pMFCEncOutputBuffer[i]) { + ret = OMX_ErrorInsufficientResources; + goto ALLOC_FAILED; + } + if (pOutbufOps->Get_Buffer) { if (pOutbufOps->Get_Buffer(pH264Enc->hMFCH264Handle.hMFCHandle, i, &pBuffer) != VIDEO_ERROR_NONE) { Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to get Output buffer info"); diff --git a/openmax/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c b/openmax/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c index d775ad4..1ecfe21 100755 --- a/openmax/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c +++ b/openmax/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c @@ -1157,6 +1157,11 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent) pVideoEnc->pMFCEncOutputBuffer[i] = (CODEC_ENC_BUFFER *)Exynos_OSAL_Malloc(sizeof(CODEC_ENC_BUFFER)); + if (!pVideoEnc->pMFCEncOutputBuffer[i]) { + ret = OMX_ErrorInsufficientResources; + goto ALLOC_FAILED; + } + if (pOutbufOps->Get_Buffer) { if (pOutbufOps->Get_Buffer(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle, i, &pBuffer) != VIDEO_ERROR_NONE) { Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to get Output buffer info"); |