SVACE Issue Resolved 38/70738/1 accepted/tizen/mobile/20160524.005405 submit/tizen_mobile/20160523.152344 submit/tizen_mobile/20160526.061651
authorChandan <ch.kumar@samsung.com>
Fri, 20 May 2016 08:55:21 +0000 (14:25 +0530)
committerChandan <ch.kumar@samsung.com>
Fri, 20 May 2016 08:55:21 +0000 (14:25 +0530)
Change-Id: I8192eb93e601a3012de372c58cf58c6788159fe4
Signed-off-by: Chandan <ch.kumar@samsung.com>
src/2dview/gl-timeline.c
src/util/gl-util.c

index 46ac23bc46cf1ebec2d03c4a317c970a49e85931..4410fd95bd459a4943cdfc51ef39348b0b8f0190 100644 (file)
@@ -2830,6 +2830,9 @@ int _get_count_of_items_on_same_date(gl_media_s *item, Eina_List *list, char **t
        for (i = start_index; i < item_cnt ; i++) {
                item = eina_list_nth(list, i);
                if (!item) {
+                       if (text3) {
+                               g_free(text3);
+                       }
                        return 0;
                }
                mtime1 = item->mtime;
@@ -2841,11 +2844,17 @@ int _get_count_of_items_on_same_date(gl_media_s *item, Eina_List *list, char **t
                }
                count ++;
                if (text1) {
+                       if (text3) {
+                               g_free(text3);
+                               text3 = NULL;
+                       }
                        text3 = g_strdup_printf("%s", text1);
                }
        }
        *text = g_strdup_printf("%s", text3);
-
+       if (text3) {
+               g_free(text3);
+       }
        return count;
 }
 
index 515e9500da95baf90b683a07d05457736618e2fe..58e8d75fade9a3749073d91dc05148d7ac9bf9df 100644 (file)
@@ -584,13 +584,15 @@ int gl_get_selected_files_path_str(void *data, gchar sep_c, char **path_str,
                        return -1;
                }
 
-               if (strstr(selected_path_list->str, current->item->file_url)) {
-                       gl_dbgW("Already appended!");
-               } else {
-                       selected_item_cnt++;
-                       g_string_append(selected_path_list,
-                                       current->item->file_url);
-                       g_string_append_c(selected_path_list, sep_c);
+               if (selected_path_list) {
+                       if (strstr(selected_path_list->str, current->item->file_url)) {
+                               gl_dbgW("Already appended!");
+                       } else {
+                               selected_item_cnt++;
+                               g_string_append(selected_path_list,
+                                               current->item->file_url);
+                               g_string_append_c(selected_path_list, sep_c);
+                       }
                }
 
        }
@@ -598,17 +600,19 @@ int gl_get_selected_files_path_str(void *data, gchar sep_c, char **path_str,
        if (sel_cnt) {
                *sel_cnt = selected_item_cnt;
        }
-       int len = strlen(selected_path_list->str);
-       g_string_truncate(selected_path_list, len - 1);
-       /**
-       * Frees the memory allocated for the GString.
-       * If free_segment is true it also frees the character data.
-       * If it's false, the caller gains ownership of the buffer
-       * and must free it after use with g_free().
-       */
-       *path_str = g_string_free(selected_path_list, false);
-       GL_CHECK_VAL(*path_str, -1);
-       gl_dbg("Total string:\n\n\t>>@@:> %s <:@@<<\n", *path_str);
+       if (selected_path_list) {
+               int len = strlen(selected_path_list->str);
+               g_string_truncate(selected_path_list, len - 1);
+               /**
+                * Frees the memory allocated for the GString.
+                * If free_segment is true it also frees the character data.
+                * If it's false, the caller gains ownership of the buffer
+                * and must free it after use with g_free().
+                */
+               *path_str = g_string_free(selected_path_list, false);
+               GL_CHECK_VAL(*path_str, -1);
+               gl_dbg("Total string:\n\n\t>>@@:> %s <:@@<<\n", *path_str);
+       }
        return 0;
 }