From: Haejeong Kim Date: Mon, 24 Jul 2017 07:51:24 +0000 (+0900) Subject: Fix PVS warnings X-Git-Tag: submit/tizen/20170726.032629~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9b2f9fe24bbe2dcacc4c4399c38280bd1d4f198;p=platform%2Fcore%2Fapi%2Fimage-util.git Fix PVS warnings Change-Id: Ie7e00af0e0c47c3a7e50233a6544e9df50bdf4ac --- diff --git a/src/image_util.c b/src/image_util.c index 1c20033..c389703 100755 --- a/src/image_util.c +++ b/src/image_util.c @@ -1082,6 +1082,13 @@ int image_util_decode_set_input_path(image_util_decode_h handle, const char *pat return IMAGE_UTIL_ERROR_NO_SUCH_FILE; } src_buffer = (void *)malloc(sizeof(_PNG_HEADER)); + if (src_buffer == NULL) { + image_util_error("malloc fail"); + fclose(fp); + fp = NULL; + return IMAGE_UTIL_ERROR_OUT_OF_MEMORY; + } + if (!fread(src_buffer, 1, sizeof(_PNG_HEADER), fp)) { image_util_error("File read failed"); fclose(fp); @@ -1878,6 +1885,8 @@ int image_util_encode_set_input_buffer(image_util_encode_h handle, const unsigne } else { if (_handle->src_buffer == NULL) _handle->src_buffer = (void *)calloc(1, sizeof(void *)); + image_util_retvm_if(_handle->src_buffer == NULL, IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "calloc fail"); + _handle->src_buffer[_handle->current_buffer_count] = (void *)src_buffer; }