Prevent issue fix 53/49353/2
authorHaejeong, Kim <backto.kim@samsung.com>
Tue, 13 Oct 2015 01:38:48 +0000 (10:38 +0900)
committerHaejeong, Kim <backto.kim@samsung.com>
Tue, 13 Oct 2015 01:42:19 +0000 (10:42 +0900)
Change-Id: I4d5146b06aa692f7c04b54cb24ec32de5ad9d58a

src/media_content.c
src/media_info.c
src/media_util_private.c

index a980345ff31215ac855842e99e97df4bb72fd378..ea518afbc7e7a71b4956dbbb5c849d19246e3f46 100755 (executable)
@@ -603,11 +603,11 @@ int __media_content_cynara_check(const char *privilege)
                smack = fgets(buf, sizeof(buf), pFile);
                fclose(pFile);
        } else {
+               SAFE_FREE(session);
                media_content_error("current info read failed");
                return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
        }
 
-
        G_LOCK(cynara_mutex);
        result = cynara_check(_cynara, smack, session, c_uid, privilege);
        G_UNLOCK(cynara_mutex);
index ac388229e2b2931da22cc7abe542e9e663eecb5f..b57c48eae61bea5e2f1d0a36d7811c5132036441 100755 (executable)
@@ -111,8 +111,7 @@ static bool __media_info_delete_batch_cb(media_info_h media, void *user_data)
        media_content_type_e media_type = 0;
        GArray *thumb_list = (GArray *)user_data;
 
-       if (media == NULL)
-       {
+       if (media == NULL) {
                media_content_debug("NO Item");
                return true;
        }
@@ -122,7 +121,7 @@ static bool __media_info_delete_batch_cb(media_info_h media, void *user_data)
                media_content_debug("media_type : [%d]", media_type);
 
                media_info_get_thumbnail_path(media, &thumb_path);
-               if (STRING_VALID(thumb_path)) {
+               if (STRING_VALID(thumb_path) && STRING_VALID(MEDIA_CONTENT_THUMB_DEFAULT_PATH)) {
                        if (strncmp(MEDIA_CONTENT_THUMB_DEFAULT_PATH, thumb_path, strlen(MEDIA_CONTENT_THUMB_DEFAULT_PATH)) != 0) {
                                g_array_append_val(thumb_list, thumb_path);
                        }
@@ -3365,7 +3364,7 @@ int media_info_create(const char *path, media_info_h *media)
 
        memset(storage_id, 0x00, sizeof(storage_id));
 
-       if (strstr(MEDIA_ROOT_PATH_CLOUD, path) == NULL) {
+       if (STRING_VALID(MEDIA_ROOT_PATH_CLOUD) && (strstr(MEDIA_ROOT_PATH_CLOUD, path) == NULL)) {
                bool ignore_file = FALSE;
                bool ignore_dir = FALSE;
                char *folder_path = NULL;
index 8587baa2da501ae3d9fcca8cbf8024b0270157e1..4bd9d82f44abc0e02fb2ce2bb908ccad1ecb424a 100755 (executable)
@@ -138,21 +138,16 @@ int _media_util_check_ignore_dir(const char *dir_path, bool *ignore)
                else
                {
                        /*If root path, Stop Scanning*/
-                       if((storage_type == MEDIA_SVC_STORAGE_INTERNAL) && (strcmp(search_path, MEDIA_ROOT_PATH_INTERNAL) == 0))
-                       {
+                       if((storage_type == MEDIA_SVC_STORAGE_INTERNAL) && (strcmp(search_path, MEDIA_ROOT_PATH_INTERNAL) == 0)) {
                                break;
-                       }
-                       else if((storage_type == MEDIA_SVC_STORAGE_EXTERNAL) && (strcmp(search_path, MEDIA_ROOT_PATH_SDCARD) == 0))
-                       {
+                       } else if((storage_type == MEDIA_SVC_STORAGE_EXTERNAL) && (STRING_VALID(MEDIA_ROOT_PATH_SDCARD)) && (strcmp(search_path, MEDIA_ROOT_PATH_SDCARD) == 0)) {
                                break;
-                       }
-                       else if(storage_type == MEDIA_SVC_STORAGE_EXTERNAL_USB)
-                       {
+                       } else if(storage_type == MEDIA_SVC_STORAGE_EXTERNAL_USB) {
                                char *parent_folder_path = NULL;
                                bool is_root = FALSE;
 
                                parent_folder_path = g_path_get_dirname(search_path);
-                               if (strcmp(search_path, MEDIA_ROOT_PATH_USB) == 0)
+                               if (STRING_VALID(MEDIA_ROOT_PATH_USB) && (strcmp(parent_folder_path, MEDIA_ROOT_PATH_USB) == 0))
                                        is_root = TRUE;
 
                                SAFE_FREE(parent_folder_path);