Svace issue Fix 14/177114/8 submit/tizen/20180831.124001 submit/tizen/20180831.162406 submit/tizen/20180921.171241
authorTezaswy Singh <tezaswy.s@samsung.com>
Wed, 25 Apr 2018 11:39:27 +0000 (17:09 +0530)
committerTezaswy Singh <tezaswy.s@samsung.com>
Thu, 3 May 2018 08:40:53 +0000 (14:10 +0530)
Change-Id: I5961f206d10888cf20c32b638b4da1cf7a45bca6

src/common/mp-file-util.c
src/widget/mp-album-list.c
src/widget/mp-track-list.c

index 2d76fb3..a7b3e70 100644 (file)
@@ -328,17 +328,22 @@ int mp_file_cp(const char *src, const char *dst)
                return 0;
        }
 
-       if (!realpath(src, realpath1)) {
+       realpath1 = realpath(src, NULL);
+       if (!realpath1) {
                DEBUG_TRACE("realpath check failed");
                return 0;
        }
 
-       if (realpath(dst, realpath2) && realpath2
-               && !strcmp(realpath1, realpath2)) {
+       realpath2 = realpath(dst, NULL);
+       if (realpath2 && !strcmp(realpath1, realpath2)) {
+               free(realpath1);
+               free(realpath2);
                DEBUG_TRACE("realpath check failed");
                return 0;
        }
 
+       free(realpath1);
+       free(realpath2);
        f1 = fopen(src, "rb");
        if (!f1) {
                DEBUG_TRACE("File Open failed");
index 27c6948..c0e15a8 100644 (file)
@@ -727,10 +727,30 @@ static void _mp_album_list_recently_added_thumbpath_clicked_cb(void *data,
 
        if (list->function_type == MP_LIST_FUNC_ADD_TRACK) {
                MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager();
-               MP_CHECK(view_manager);
+               if (!view_manager) {
+                       if (name) {
+                               free(name);
+                               name = NULL;
+                       }
+                       if (artist) {
+                               free(artist);
+                               artist = NULL;
+                       }
+                       return;
+               }
                MpSelectTrackView_t *view_select_track =
                                mp_select_track_view_create(view_manager->navi);
-               MP_CHECK(view_select_track);
+               if (!view_select_track) {
+                       if (name) {
+                               free(name);
+                               name = NULL;
+                       }
+                       if (artist) {
+                               free(artist);
+                               artist = NULL;
+                       }
+                       return;
+               }
                mp_view_mgr_push_view(view_manager, (MpView_t *) view_select_track,
                                NULL);
 
@@ -755,6 +775,14 @@ static void _mp_album_list_recently_added_thumbpath_clicked_cb(void *data,
                mp_list_update(view_select_track->content_to_show);
                mp_view_update_options((MpView_t *) view_select_track);
                mp_list_set_edit(view_select_track->content_to_show, TRUE);
+               if (name) {
+                       free(name);
+                       name = NULL;
+               }
+               if (artist) {
+                       free(artist);
+                       artist = NULL;
+               }
                return;
        }
 
@@ -763,13 +791,31 @@ static void _mp_album_list_recently_added_thumbpath_clicked_cb(void *data,
                MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager();
                MpView_t *view = mp_view_mgr_get_top_view(view_mgr);
                mp_view_update_options_edit(view);
+               if (name) {
+                       free(name);
+                       name = NULL;
+               }
+               if (artist) {
+                       free(artist);
+                       artist = NULL;
+               }
                return;
        }
 
 
        /* create the view of album detail */
        MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager();
-       MP_CHECK(view_manager);
+       if (!view_manager) {
+               if (name) {
+                       free(name);
+                       name = NULL;
+               }
+               if (artist) {
+                       free(artist);
+                       artist = NULL;
+               }
+               return;
+       }
        MpAlbumDetailView_t *view_album_detail =
                        mp_album_detail_view_create(view_manager->navi, name, artist,
                                        thumbnail);
@@ -778,6 +824,14 @@ static void _mp_album_list_recently_added_thumbpath_clicked_cb(void *data,
 
        mp_view_update_options((MpView_t *) view_album_detail);
        mp_view_set_title((MpView_t *) view_album_detail, name);
+       if (name) {
+               free(name);
+               name = NULL;
+       }
+       if (artist) {
+               free(artist);
+               artist = NULL;
+       }
 }
 
 char *_mp_album_list_recently_added_text_get(void *data, Evas_Object * obj, const char *part)
@@ -840,6 +894,10 @@ Evas_Object *_mp_album_list_recently_added_content_get(void *data, Evas_Object *
                if (!item) {
                        DEBUG_TRACE
                        ("Fail to mp_media_info_group_list_nth_item, index[%d]", index);
+                       if (thumb_path) {
+                               free(thumb_path);
+                               thumb_path = NULL;
+                       }
                        return NULL;
                }
                mp_media_info_group_get_thumbnail_path(item, &thumb_path);
@@ -853,7 +911,13 @@ Evas_Object *_mp_album_list_recently_added_content_get(void *data, Evas_Object *
                }
 
                mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t));
-               MP_CHECK_NULL(item_data);
+               if (!item_data) {
+                       if (thumb_path) {
+                               free(thumb_path);
+                               thumb_path = NULL;
+                       }
+                       return NULL;
+               }
                item_data->handle = item;
                item_data->index = index;
                item_data->group_type = MP_GROUP_BY_ALBUM;
@@ -870,7 +934,7 @@ Evas_Object *_mp_album_list_recently_added_content_get(void *data, Evas_Object *
                        evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND,
                                        EVAS_HINT_EXPAND);
                        Evas_Object* image = elm_image_add(obj);
-                       elm_image_file_set(image, thumb_path,NULL);
+                       elm_image_file_set(image, thumb_path, NULL);
                        elm_image_fill_outside_set(image, true);
                        elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE);
                        evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -883,6 +947,10 @@ Evas_Object *_mp_album_list_recently_added_content_get(void *data, Evas_Object *
                        evas_object_data_set(content, "genlist_obj", list->genlist);
                        elm_object_signal_callback_add(content, "mouse,clicked,1", "*",
                                        _mp_album_list_recently_added_thumbpath_clicked_cb, item_data);
+                       if (thumb_path) {
+                               free(thumb_path);
+                               thumb_path = NULL;
+                       }
                        return content;
                }
                part_name[0] = '\0';
@@ -912,8 +980,16 @@ Evas_Object *_mp_album_list_recently_added_content_get(void *data, Evas_Object *
                        evas_object_data_set(content, "genlist_obj", list->genlist);
                        elm_object_signal_callback_add(content, "mouse,clicked,1", "*",
                                        _mp_album_list_recently_added_play_icon_clicked_cb, item_data);
+                       if (thumb_path) {
+                               free(thumb_path);
+                               thumb_path = NULL;
+                       }
                        return content;
                }
+               if (thumb_path) {
+                       free(thumb_path);
+                       thumb_path = NULL;
+               }
        }
        return NULL;
 }
index 172fabb..fc6edd4 100644 (file)
@@ -603,8 +603,8 @@ static void _mp_track_list_append_item(MpTrackList_t * list,
                        if (ad->checkedList) {
                                ad->checkedList = g_list_first(ad->checkedList);
                                GList *l;
-                               for(l = ad->checkedList ; l !=NULL ; l = l->next) {
-                                       if(g_strcmp0(l->data, file_path) == 0) {
+                               for (l = ad->checkedList ; l != NULL ; l = l->next) {
+                                       if (g_strcmp0(l->data, file_path) == 0) {
                                                item_data->checked = EINA_TRUE;
                                                break;
                                        }
@@ -991,7 +991,13 @@ Evas_Object *_mp_track_list_recently_added_content_get(void *data, Evas_Object *
                }
 
                mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t));
-               MP_CHECK_NULL(item_data);
+               if (!item_data) {
+                       if (thumb_path) {
+                               free(thumb_path);
+                               thumb_path = NULL;
+                       }
+                       return NULL;
+               }
                item_data->handle = item;
                item_data->index = index;
                item_data->group_type = MP_GROUP_NONE;
@@ -1021,6 +1027,10 @@ Evas_Object *_mp_track_list_recently_added_content_get(void *data, Evas_Object *
                        evas_object_data_set(content, "genlist_obj", list->genlist);
                        elm_object_signal_callback_add(content, "mouse,clicked,1", "*",
                                        _mp_track_list_recently_added_thumbpath_clicked_cb, NULL);
+                       if (thumb_path) {
+                               free(thumb_path);
+                               thumb_path = NULL;
+                       }
                        return content;
                }
                part_name[0] = '\0';
@@ -1049,8 +1059,16 @@ Evas_Object *_mp_track_list_recently_added_content_get(void *data, Evas_Object *
                        evas_object_data_set(content, "genlist_obj", list->genlist);
                        elm_object_signal_callback_add(content, "mouse,clicked,1", "*",
                                        _mp_track_list_recently_added_play_icon_clicked_cb, item_data);
+                       if (thumb_path) {
+                               free(thumb_path);
+                               thumb_path = NULL;
+                       }
                        return content;
                }
+               if (thumb_path) {
+                       free(thumb_path);
+                       thumb_path = NULL;
+               }
        }
        return NULL;
 }