Fix the occasional crash issue when language changing. 09/80009/1 accepted/tizen/common/20160714.153549 accepted/tizen/ivi/20160714.095934 accepted/tizen/mobile/20160714.095841 accepted/tizen/tv/20160714.095856 accepted/tizen/wearable/20160714.095915 submit/tizen/20160714.065308
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 14 Jul 2016 05:48:48 +0000 (14:48 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Thu, 14 Jul 2016 05:48:48 +0000 (14:48 +0900)
Change-Id: I47a50a94572521d1a9981ca3da17eaf9dcbcb494
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
packaging/media-server.spec
src/common/media-common-db-svc.c
src/scanner/media-scanner-scan.c

index c765bda..d270ca0 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       media-server
 Summary:    A server for media content management
-Version:    0.2.97
+Version:    0.2.98
 Release:    0
 Group:      Multimedia/Service
 License:    Apache-2.0
index 7c4ce3a..638f158 100755 (executable)
@@ -713,15 +713,25 @@ int ms_send_dir_update_noti(void **handle, const char* storage_id, const char*pa
        int lib_index;
        int ret;
        char *err_msg = NULL;
+       char *get_path = NULL;
+
+       if (MS_STRING_VALID(path)) {
+               get_path = strndup(path, strlen(path));
+       } else {
+               MS_DBG_ERR("path is invalid string");
+               return MS_MEDIA_ERR_SEND_NOTI_FAIL;
+       }
 
        for (lib_index = 0; lib_index < lib_num; lib_index++) {
-               ret = ((SEND_DIR_UPDATE_NOTI)func_array[lib_index][eSEND_DIR_UPDATE_NOTI])(handle[lib_index], storage_id, path, folder_id, (int)noti_type, pid, &err_msg); /*dlopen*/
+               ret = ((SEND_DIR_UPDATE_NOTI)func_array[lib_index][eSEND_DIR_UPDATE_NOTI])(handle[lib_index], storage_id, get_path, folder_id, (int)noti_type, pid, &err_msg); /*dlopen*/
                if (ret != 0) {
                        MS_DBG_ERR("error : %s [%s]", g_array_index(so_array, char*, lib_index), err_msg);
                        MS_SAFE_FREE(err_msg);
+                       MS_SAFE_FREE(get_path);
                        return MS_MEDIA_ERR_SEND_NOTI_FAIL;
                }
        }
+       MS_SAFE_FREE(get_path);
 
        return MS_MEDIA_ERR_NONE;
 }
index f47fa7e..e508a67 100755 (executable)
@@ -1583,7 +1583,12 @@ static int __msc_dir_scan_meta_update(void **handle, const char*start_path, cons
        char path[MS_FILE_PATH_LEN_MAX] = { 0 };
        int (*scan_function)(void **, const char *, const char*, uid_t) = ms_update_meta_batch;
 
-       tmp_path = strdup(start_path);
+       if (MS_STRING_VALID(start_path)) {
+               tmp_path = strndup(start_path, strlen(start_path));
+       } else {
+               MS_DBG_ERR("start_path is invalid parameter");
+               return MS_MEDIA_ERR_INVALID_PATH;
+       }
 
        /* make new array for storing directory */
        dir_array = g_array_new(FALSE, FALSE, sizeof(char*));