unsigned int height = 0;
unsigned int resized_width = 0;
unsigned int resized_height = 0;
- mm_util_img_codec_type img_type = IMG_CODEC_NONE;
+ mm_util_img_codec_type img_type = IMG_CODEC_UNKNOWN_TYPE;
if ((strstr(img_format, "jpeg") != NULL) || (strstr(img_format, "jpg") != NULL) || (strstr(img_format, "JPG") != NULL)) {
media_svc_debug("type [jpeg]");
FILE *fp = NULL;
long app1_size = 0;
int size = 1;
- unsigned char exif_header[4];
- unsigned char exif_app1[2];
- unsigned char exif_app1_xmp[2];
+ unsigned char exif_header[4] = {0, };
+ unsigned char exif_app1[2] = {0, };
+ unsigned char exif_app1_xmp[2] = {0, };
long exif_app1_xmp_size = 0;
- unsigned char exif_app1_xmp_t[2];
+ unsigned char exif_app1_xmp_t[2] = {0, };
char *xmp_data = NULL;
int size1 = 0;
int size2 = 0;
int fdata = 0;
int temp = 0;
+ memset(exif_header, 0x00, sizeof(exif_header));
+ memset(exif_app1, 0x00, sizeof(exif_app1));
+ memset(exif_app1_xmp, 0x00, sizeof(exif_app1_xmp));
+ memset(exif_app1_xmp_t, 0x00, sizeof(exif_app1_xmp_t));
+
fp = fopen(path, "rb");
if (fp == NULL)
goto ERROR;
exif_app1_xmp_size = size1 * 256 + size2 - 2;
- xmp_data = (char *)malloc(exif_app1_xmp_size);
- if (xmp_data != NULL) {
+ if (exif_app1_xmp_size > 0) {
+ xmp_data = (char *)malloc(exif_app1_xmp_size);
memset(xmp_data, 0x0, exif_app1_xmp_size);
+
ptr = xmp_data;
while (exif_app1_xmp_size >= 0) {
SAFE_FREE(xmp_data);
} else {
- media_svc_error("malloc failed");
+ media_svc_error("invalid exif_app1_xmp_size [%ld]", exif_app1_xmp_size);
}
if (fp) {
/*Get image width, height*/
unsigned int img_width = 0;
unsigned int img_height = 0;
- mm_util_img_codec_type img_type = IMG_CODEC_NONE;
+ mm_util_img_codec_type img_type = IMG_CODEC_UNKNOWN_TYPE;
mm_util_extract_image_info(path, &img_type, &img_width, &img_height);
if (content_info->media_meta.width == 0)
SAFE_FREE(time_info);
} else {
media_svc_error("memory allocation error");
- ret = MS_MEDIA_ERR_OUT_OF_MEMORY;
}
} else {
content_info->media_meta.recorded_date = g_strdup(p);
unsigned int origin_h = 0;
unsigned int thumb_w = THUMB_WIDTH;
unsigned int thumb_h = THUMB_HEIGHT;
- mm_util_img_codec_type image_type = IMG_CODEC_NONE;
+ mm_util_img_codec_type image_type = IMG_CODEC_UNKNOWN_TYPE;
if (path == NULL || thumb_path == NULL) {
media_svc_error("Invalid parameter");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- media_svc_sec_debug("Path : %s", path);
+ media_svc_sec_debug("Path[%s] Type[%d]", path, media_type);
//1. make hash path
ret = _media_svc_get_thumbnail_path(store_type, media_type, thumb_path, path, THUMB_EXT, uid);
media_svc_debug("Origin:W[%d] H[%d] Proper:W[%d] H[%d]", origin_w, origin_h, thumb_w, thumb_h);
- ret = mm_util_create_handle(&img, (unsigned char *)frame, origin_w, origin_h, size, MM_UTIL_IMG_FMT_RGB888);
+ ret = mm_util_create_handle(&img, (unsigned char *)frame, origin_w, origin_h, size, MM_UTIL_COLOR_RGB24);
if (origin_w > thumb_w || origin_h > thumb_h) {
if (rot_type != MM_UTIL_ROTATE_0) {
ret = mm_util_resize_B_B(img, thumb_w, thumb_h, &resize_img);