summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehun Lim <jehun.lim@samsung.com>2015-10-15 06:08:31 (GMT)
committerJehun Lim <jehun.lim@samsung.com>2015-10-15 06:08:31 (GMT)
commit1365c2d687a0c9b719637c6be26aa0b940f195e8 (patch)
treea25ee3ecd4d4956303e8f42e5d9469448345f516
parentf99c5991a89dfd6b88370afff0d802f29aaffff7 (diff)
downloadair_mediahub-1365c2d687a0c9b719637c6be26aa0b940f195e8.zip
air_mediahub-1365c2d687a0c9b719637c6be26aa0b940f195e8.tar.gz
air_mediahub-1365c2d687a0c9b719637c6be26aa0b940f195e8.tar.bz2
(prevent: 485022, 485110, 485150, 485223, 485238, 485279, 486864) Change-Id: I8b432f7f2a4f6620a8c7b1c074e475473a23273f Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
-rw-r--r--src/data/albumdata.c20
-rw-r--r--src/data/folderdata.c53
2 files changed, 40 insertions, 33 deletions
diff --git a/src/data/albumdata.c b/src/data/albumdata.c
index 9aa9537..a81f3a0 100644
--- a/src/data/albumdata.c
+++ b/src/data/albumdata.c
@@ -181,17 +181,21 @@ static void _destroy_media_list(Eina_List *list)
app_media_destroy(am);
}
+static void _destroy_album_info(struct album_info *ai)
+{
+ free(ai->name);
+ free(ai->artist);
+ free(ai->album_art);
+
+ free(ai);
+}
+
static void _destroy_album_list(Eina_List *list)
{
struct album_info *ai;
- EINA_LIST_FREE(list, ai) {
- free(ai->name);
- free(ai->artist);
- free(ai->album_art);
-
- free(ai);
- }
+ EINA_LIST_FREE(list, ai)
+ _destroy_album_info(ai);
}
static bool _get_each_media_info(media_info_h media_h, void *data)
@@ -276,7 +280,7 @@ static bool _get_each_album_info(media_album_h album, void *data)
err:
media_filter_destroy(filter);
- free(ai);
+ _destroy_album_info(ai);
return false;
}
diff --git a/src/data/folderdata.c b/src/data/folderdata.c
index 2f1d48f..bd9ad40 100644
--- a/src/data/folderdata.c
+++ b/src/data/folderdata.c
@@ -159,18 +159,22 @@ static char *_get_title(app_media_info *mi)
return strndup(mi->title, 1);
}
+static void _destroy_folder_info(struct folder_info *fi)
+{
+ free(fi->id);
+ free(fi->name);
+ free(fi->path);
+ free(fi->parent_id);
+
+ free(fi);
+}
+
static void _destroy_folder_list(Eina_List *list)
{
struct folder_info *fi;
- EINA_LIST_FREE(list, fi) {
- free(fi->id);
- free(fi->name);
- free(fi->path);
- free(fi->parent_id);
-
- free(fi);
- }
+ EINA_LIST_FREE(list, fi)
+ _destroy_folder_info(fi);
}
static void _destroy_media_list(Eina_List *list)
@@ -216,46 +220,40 @@ static bool _get_each_folder_info(media_folder_h folder, void *data)
return false;
}
+ if (!_create_filter(fd, &filter, NULL, E_FILTER_MEDIA)) {
+ _ERR("failed to create filter");
+ free(fi);
+ return false;
+ }
+
if (media_folder_get_folder_id(folder, &(fi->id))
!= MEDIA_CONTENT_ERROR_NONE) {
_ERR("failed to fetch folder id");
- free(fi);
- return false;
+ goto err;
}
if (media_folder_get_name(folder, &(fi->name))
!= MEDIA_CONTENT_ERROR_NONE) {
_ERR("failed to fetch folder name");
- free(fi);
- return false;
+ goto err;
}
if (media_folder_get_path(folder, &(fi->path))
!= MEDIA_CONTENT_ERROR_NONE) {
_ERR("failed to fetch folder path");
- free(fi);
- return false;
+ goto err;
}
if (media_folder_get_parent_folder_id(folder, &(fi->parent_id))
!= MEDIA_CONTENT_ERROR_NONE) {
_ERR("failed to fetch parent folder id");
- free(fi);
- return false;
- }
-
- if (!_create_filter(fd, &filter, NULL, E_FILTER_MEDIA)) {
- _ERR("failed to create filter");
- free(fi);
- return false;
+ goto err;
}
if (media_folder_get_media_count_from_db(fi->id, filter, &(fi->count))
!= MEDIA_CONTENT_ERROR_NONE) {
_ERR("failed to get media count");
- free(fi);
- media_filter_destroy(filter);
- return false;
+ goto err;
}
fd->folder_list = eina_list_append(fd->folder_list, fi);
@@ -263,6 +261,11 @@ static bool _get_each_folder_info(media_folder_h folder, void *data)
media_filter_destroy(filter);
return true;
+
+err:
+ media_filter_destroy(filter);
+ _destroy_folder_info(fi);
+ return false;
}
static bool _get_each_media_info(media_info_h media_h, void *data)