From b807cc4f6b49f13fda0d2457ea3e7454728c8028 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Thu, 13 Jul 2017 11:49:45 +0900 Subject: [PATCH] Fix memory allocation and acces issue [Version] 0.10.126 [Profile] Common [Issue Type] Bug fix [Issue#] SATIZENVUL-927 [Dependency module] N/A Change-Id: Icdc472148309c41fa486c7f32c9bab0c027630aa Signed-off-by: Jeongmo Yang --- packaging/libmm-camcorder.spec | 2 +- src/mm_camcorder_stillshot.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index 21a6735..0963808 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -1,6 +1,6 @@ Name: libmm-camcorder Summary: Camera and recorder library -Version: 0.10.125 +Version: 0.10.126 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_camcorder_stillshot.c b/src/mm_camcorder_stillshot.c index 4c9dcc0..0539c50 100644 --- a/src/mm_camcorder_stillshot.c +++ b/src/mm_camcorder_stillshot.c @@ -1359,12 +1359,16 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl /* Make sure the image had a thumbnail before trying to write it */ if (ed->data && ed->size) { thumb.data = malloc(ed->size); - memcpy(thumb.data, ed->data, ed->size); - thumb.length = ed->size; - thumb.format = MM_PIXEL_FORMAT_ENCODED; - thumb.width = atoi(width); - thumb.height = atoi(height); - internal_thumb_data = thumb.data; + if (thumb.data) { + memcpy(thumb.data, ed->data, ed->size); + thumb.length = ed->size; + thumb.format = MM_PIXEL_FORMAT_ENCODED; + thumb.width = atoi(width); + thumb.height = atoi(height); + internal_thumb_data = thumb.data; + } else { + _mmcam_dbg_err("failed to alloc thumbnail data"); + } } exif_data_unref(ed); ed = NULL; -- 2.34.1