Fix memory allocation and acces issue 09/138609/1
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 13 Jul 2017 02:49:45 +0000 (11:49 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 13 Jul 2017 02:49:45 +0000 (11:49 +0900)
[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 <jm80.yang@samsung.com>
packaging/libmm-camcorder.spec
src/mm_camcorder_stillshot.c

index 21a6735d1a857cf760d73a3f2c3048b192cd14c4..096380879401a7f37a633b02c47a9d078dd63952 100644 (file)
@@ -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
index 4c9dcc033e0cd3f9d375506199d8bcc7df00d824..0539c506f3b00dbce9da578998089622790e332a 100644 (file)
@@ -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;