summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehun Lim <jehun.lim@samsung.com>2015-10-14 00:58:08 (GMT)
committerJehun Lim <jehun.lim@samsung.com>2015-10-14 01:14:17 (GMT)
commitc328cf7f266ee6385c7e42cb16cce7557a975ae7 (patch)
tree0778fbe57f3a0563074476ec77d38a7e9b44c632
parentd01b4a64751f98c57702b38063923956e0b96ac4 (diff)
downloadair_mediahub-c328cf7f266ee6385c7e42cb16cce7557a975ae7.zip
air_mediahub-c328cf7f266ee6385c7e42cb16cce7557a975ae7.tar.gz
air_mediahub-c328cf7f266ee6385c7e42cb16cce7557a975ae7.tar.bz2
folderdata: add variable null check (prevent: 483570)refs/changes/85/49485/2
Change-Id: I3bc706dcd879ee8c3ab79c53de5453b3b17a364f Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
-rw-r--r--src/data/albumdata.c6
-rw-r--r--src/data/folderdata.c4
-rw-r--r--src/data/mediadata.c12
3 files changed, 11 insertions, 11 deletions
diff --git a/src/data/albumdata.c b/src/data/albumdata.c
index 9b2ff52..9aa9537 100644
--- a/src/data/albumdata.c
+++ b/src/data/albumdata.c
@@ -127,7 +127,7 @@ static bool _create_filter(struct albumdata *ad, filter_h *filter,
static int _compare_name(struct group_info *gi, struct album_info *ai)
{
- if (!gi || !gi->data || !ai->name)
+ if (!gi->data || !ai->name)
return -1;
return strncasecmp(gi->data, ai->name, 1);
@@ -151,7 +151,7 @@ static char *_get_name(struct album_info *ai)
static int _compare_artist(struct group_info *gi, struct album_info *ai)
{
- if (!gi || !gi->data || !ai->artist)
+ if (!gi->data || !ai->artist)
return -1;
return strncasecmp(gi->data, ai->artist, 1);
@@ -570,7 +570,7 @@ static Eina_List *_get_group(void *handle, int type, void *data)
gi = NULL;
list = NULL;
EINA_LIST_FOREACH(ad->album_list, l, ai) {
- if (g_group_info[type].media_cmp(gi, ai)) {
+ if (!gi || g_group_info[type].media_cmp(gi, ai)) {
gi = calloc(1, sizeof(*gi));
if (!gi) {
_ERR("failed to create group info");
diff --git a/src/data/folderdata.c b/src/data/folderdata.c
index 339af9a..2f1d48f 100644
--- a/src/data/folderdata.c
+++ b/src/data/folderdata.c
@@ -137,7 +137,7 @@ static int _compare_cb_name(const void *data1, const void *data2)
static int _compare_title(struct group_info *gi, app_media_info *mi)
{
- if (!gi || !gi->data || !mi->title)
+ if (!gi->data || !mi->title)
return -1;
return strncasecmp(gi->data, mi->title, 1);
@@ -576,7 +576,7 @@ static Eina_List *_get_group(void *handle, int type, void *data)
return NULL;
}
- if (g_group_info[type].media_cmp(gi, mi)) {
+ if (!gi || g_group_info[type].media_cmp(gi, mi)) {
gi = calloc(1, sizeof(*gi));
if (!gi) {
_ERR("failed to create group info");
diff --git a/src/data/mediadata.c b/src/data/mediadata.c
index 44663ec..3f68f37 100644
--- a/src/data/mediadata.c
+++ b/src/data/mediadata.c
@@ -142,7 +142,7 @@ static char *_get_date_string(struct tm *tm)
static int _compare_title(struct group_info *gi, app_media_info *info)
{
- if (!gi || !gi->data || !info->title)
+ if (!gi->data || !info->title)
return -1;
return strncasecmp(gi->data, info->title, 1);
@@ -168,7 +168,7 @@ static int _compare_time(struct group_info *gi, app_media_info *info)
{
struct tm *tm;
- if (!gi || !gi->data)
+ if (!gi->data)
return -1;
tm = gi->data;
@@ -218,7 +218,7 @@ static int _compare_genre(struct group_info *gi, app_media_info *info)
genre = _get_genre_string(info);
- if (!gi || !gi->data || !genre)
+ if (!gi->data || !genre)
return -1;
return strcmp(gi->data, genre);
@@ -276,7 +276,7 @@ static void _get_place_string(const char *src, char **city, char **country)
static int _compare_place(struct group_info *gi, app_media_info *info)
{
- if (!gi || !gi->data)
+ if (!gi->data)
return -1;
if (!info->location_tag)
@@ -305,7 +305,7 @@ static int _compare_type(struct group_info *gi, app_media_info *info)
{
int *type;
- if (!gi || !gi->data)
+ if (!gi->data)
return -1;
type = gi->data;
@@ -676,7 +676,7 @@ static Eina_List *_get_group(void *handle, int type, void *data)
return NULL;
}
- if (g_group_info[type].media_cmp(gi, info)) {
+ if (!gi || g_group_info[type].media_cmp(gi, info)) {
gi = calloc(1, sizeof(*gi));
if (!gi) {
_ERR("failed to create group info");