Fix wrong buffer size of media_packet 72/190972/1
authorjiyong.min <jiyong.min@samsung.com>
Wed, 10 Oct 2018 04:36:48 +0000 (13:36 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Wed, 10 Oct 2018 05:52:09 +0000 (05:52 +0000)
Change-Id: I74c107ec60d6691ed48972ca770d6b502edf3ec4

src/image_util.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 1d6be7a..6f089e1
@@ -209,6 +209,13 @@ static int _image_util_image_to_packet(mm_util_color_image_h image, media_packet
        image_util_debug("Size: result(%u) media_packet(%" PRIu64 ") copied(%zu)", buffer_size, packet_size, size);
        memcpy(packet_ptr, buffer, size);
 
+       err = media_packet_set_buffer_size(*packet, (uint64_t)size);
+       if (err != MEDIA_PACKET_ERROR_NONE) {
+               image_util_error("media_packet_set_buffer_size failed (%d)", err);
+               media_packet_destroy(*packet);
+               return IMAGE_UTIL_ERROR_INVALID_OPERATION;
+       }
+
        image_util_debug("_image_util_image_to_packet succeed");
 
        return IMAGE_UTIL_ERROR_NONE;