From 5364dcb2f2b33da4e634abb76869dac19a4ebe29 Mon Sep 17 00:00:00 2001 From: "jiyong.min" Date: Wed, 7 Nov 2018 09:36:03 +0900 Subject: [PATCH] Apply null pointer of the size for using output path When the path is used, the output buffer and the size are unused. Change-Id: Id0360b92fbf23c72f0bffc4429d9620012c4aabc --- src/image_util_encode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/image_util_encode.c b/src/image_util_encode.c index 168c266..9bd32ff 100755 --- a/src/image_util_encode.c +++ b/src/image_util_encode.c @@ -62,7 +62,7 @@ static void __free_source_buffer(encode_s *handle) image_util_fenter(); image_util_retm_if(handle == NULL || handle->gif_encode_info.sources == NULL, "Invalid handle"); - for(i = 0; i < handle->gif_encode_info.source_count; i++) { + for (i = 0; i < handle->gif_encode_info.source_count; i++) { IMAGE_UTIL_SAFE_FREE(handle->gif_encode_info.sources[i]); } IMAGE_UTIL_SAFE_FREE(handle->gif_encode_info.sources); @@ -320,12 +320,13 @@ int image_util_encode_run(image_util_encode_h handle, unsigned long long *size) encode_s *_handle = (encode_s *) handle; image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if(size == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter"); + image_util_retvm_if(_handle->dst_buffer != NULL && size == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter"); err = _image_util_encode_internal(_handle); image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "_image_util_encode_internal failed"); - *size = _handle->dst_size; + if (size) + *size = _handle->dst_size; return err; } -- 2.7.4