RSSyl: Free GError from memory where necessary.
[claws.git] / src / plugins / rssyl / rssyl_deleted.c
index 2d39adb..6f3a06e 100644 (file)
@@ -104,8 +104,10 @@ GSList *rssyl_deleted_update(RFolderItem *ritem)
 
        g_file_get_contents(deleted_file, &contents, NULL, &error);
 
-       if (error)
+       if (error) {
                g_warning("GError: '%s'\n", error->message);
+               g_error_free(error);
+       }
 
        if (contents != NULL) {
                lines = strsplit_no_copy(contents, '\n');
@@ -170,20 +172,25 @@ static void rssyl_deleted_store_internal(GSList *deleted_items, const gchar *del
 {
        FILE *f;
 
-       if (g_file_test(deleted_file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
-               g_remove(deleted_file);
+       if (g_file_test(deleted_file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+               if (g_remove(deleted_file) != 0) {
+                       debug_print("RSSyl: Oops, couldn't delete '%s', bailing out\n",
+                                       deleted_file);
+                       return;
+               }
+       }
 
        if (g_slist_length(deleted_items) == 0)
                return;
 
        if ((f = g_fopen(deleted_file, "w")) == NULL) {
-               debug_print("RSSyl: Couldn't open '%s', ignoring.\n", deleted_file);
+               debug_print("RSSyl: Couldn't open '%s', bailing out.\n", deleted_file);
                return;
        }
 
        g_slist_foreach(deleted_items, (GFunc)_store_one_deleted_item,
                        (gpointer)f);
-       
+
        fclose(f);
        debug_print("RSSyl: written and closed deletion file\n");
 }
@@ -225,6 +232,7 @@ void rssyl_deleted_add(RFolderItem *ritem, gchar *path)
        g_free(deleted_file);
 
        rssyl_deleted_free(deleted_items);
+       feed_item_free(fitem);
 }
 
 static gint _rssyl_deleted_check_func(gconstpointer a, gconstpointer b)