From e95c1d6cc881d0399ca761eccc96347e00b79b49 Mon Sep 17 00:00:00 2001 From: hj kim Date: Thu, 16 Nov 2017 15:16:48 +0900 Subject: [PATCH] change malloc to g_malloc0 Change-Id: I8243bad63d0803db4fe597dee45f2d87230f1775 --- libdcm-util/dcm_image_codec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libdcm-util/dcm_image_codec.c b/libdcm-util/dcm_image_codec.c index 02ecae5..8e60a43 100755 --- a/libdcm-util/dcm_image_codec.c +++ b/libdcm-util/dcm_image_codec.c @@ -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); -- 2.34.1