Fix memory leak when freeing RSSyl's FeedItem struct.
[claws.git] / src / plugins / rssyl / parse822.c
index 5eadc4a924f5c7e5169420594fc4e20d1aeadc74..c3cd109630dbb086ea1685feec401fb94e0be5ec 100644 (file)
@@ -64,14 +64,14 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path)
        g_file_get_contents(path, &contents, NULL, &error);
 
        if( error ) {
-               g_warning("GError: '%s'\n", error->message);
+               g_warning("GError: '%s'", error->message);
                g_error_free(error);
        }
 
        if( contents != NULL ) {
                lines = strsplit_no_copy(contents, '\n');
        } else {
-               g_warning("Badly formatted file found, ignoring: '%s'\n", path);
+               g_warning("Badly formatted file found, ignoring: '%s'", path);
                return NULL;
        }
 
@@ -135,7 +135,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path)
                                /* Last-Seen timestamp */
                                if( !strcmp(line[0], "X-RSSyl-Last-Seen") ) {
                                        ctx->last_seen = atol(line[1]);
-                                       debug_print("RSSyl: got last_seen timestamp %ld\n", ctx->last_seen);
+                                       debug_print("RSSyl: got last_seen timestamp %lld\n", (long long)ctx->last_seen);
                                }
 
                                /* ID */
@@ -235,8 +235,10 @@ static void rssyl_flush_folder_func(gpointer data, gpointer user_data)
        FeedItem *item = (FeedItem *)data;
        RFeedCtx *ctx = (RFeedCtx *)item->data;
 
-       if( ctx != NULL && ctx->path != NULL)
+       if( ctx != NULL && ctx->path != NULL) {
                g_free(ctx->path);
+               g_free(ctx);
+       }
        feed_item_free(item);
 }
 
@@ -245,7 +247,7 @@ static void rssyl_folder_read_existing_real(RFolderItem *ritem)
        gchar *path = NULL, *fname = NULL;
        GDir *dp;
        const gchar *d;
-       GError *error;
+       GError *error = NULL;
        gint num;
        FeedItem *item = NULL;
        RFeedCtx *ctx;
@@ -266,7 +268,6 @@ static void rssyl_folder_read_existing_real(RFolderItem *ritem)
        ritem->last_update = 0;
 
        if( (dp = g_dir_open(path, 0, &error)) == NULL ) {
-               FILE_OP_ERROR(path, "g_dir_open");
                debug_print("g_dir_open on \"%s\" failed with error %d (%s)\n",
                                path, error->code, error->message);
                g_error_free(error);