change malloc to g_malloc0 33/160433/1
authorhj kim <backto.kim@samsung.com>
Thu, 16 Nov 2017 06:16:48 +0000 (15:16 +0900)
committerhj kim <backto.kim@samsung.com>
Thu, 16 Nov 2017 06:16:48 +0000 (15:16 +0900)
Change-Id: I8243bad63d0803db4fe597dee45f2d87230f1775

libdcm-util/dcm_image_codec.c

index 02ecae50404745d8787d3df831eb019c82471c95..8e60a43547bf4e60210ed7f2af41bb613cc84e29 100755 (executable)
@@ -163,13 +163,12 @@ static int __dcm_rotate_rgb(unsigned char *source, const unsigned long long *siz
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
-       temp_buf = (unsigned char*)malloc(_size);
+       temp_buf = (unsigned char*)g_malloc0(_size);
        if (temp_buf == NULL) {
                dcm_error("Failed to allocate memory");
                return MS_MEDIA_ERR_OUT_OF_MEMORY;
        }
-       /* initialize */
-       memset(temp_buf, 0x00, _size);
+
        width = *ori_width;
        height = *ori_height;
 
@@ -279,7 +278,7 @@ int dcm_decode_image(const char *file_path, const dcm_image_format_e format,
                }
 
                *size = buffer_size;
-               resize_buffer = (unsigned char *)malloc(sizeof(unsigned char) * (buffer_size));
+               resize_buffer = (unsigned char *)g_malloc0(sizeof(unsigned char) * (buffer_size));
                if (resize_buffer != NULL) {
                        ret = image_util_resize(resize_buffer, (int *)buff_width, (int *)buff_height, decode_buffer, decode_width, decode_height, colorspace);
                        DCM_SAFE_FREE(decode_buffer);