gchar *dirname = NULL;
gchar *text = NULL;
gchar *heading = NULL;
+ gchar *pathbasename = NULL;
gchar hdr[1024];
FeedItemEnclosure *enc = NULL;
RFeedCtx *ctx;
/* Fix up subject, url and ID (rssyl_format_string()) so that
* comparing doesn't break. */
debug_print("RSSyl: fixing up subject '%s'\n", feed_item_get_title(feed_item));
- feed_item_set_title(feed_item, rssyl_format_string(feed_item_get_title(feed_item), TRUE, TRUE));
+ tmp = rssyl_format_string(feed_item_get_title(feed_item), TRUE, TRUE);
+ feed_item_set_title(feed_item, tmp);
+ g_free(tmp);
debug_print("RSSyl: fixing up URL\n");
- feed_item_set_url(feed_item, rssyl_format_string(feed_item_get_url(feed_item),
- FALSE, TRUE));
+ tmp = rssyl_format_string(feed_item_get_url(feed_item), FALSE, TRUE);
+ feed_item_set_url(feed_item, tmp);
+ g_free(tmp);
if( feed_item_get_id(feed_item) != NULL ) {
debug_print("RSSyl: fixing up ID\n");
- feed_item_set_id(feed_item, rssyl_format_string(feed_item_get_id(feed_item),
- FALSE, TRUE));
+ tmp = rssyl_format_string(feed_item_get_id(feed_item), FALSE, TRUE);
+ feed_item_set_id(feed_item, tmp);
+ g_free(tmp);
}
/* If there's a summary, but no text, use summary as text. */
/* Store permflags of the old item. */
ctx = (RFeedCtx *)old_item->data;
+ pathbasename = g_path_get_basename(ctx->path);
msginfo = folder_item_get_msginfo((FolderItem *)ritem,
- atoi(g_path_get_basename(ctx->path)));
+ atoi(pathbasename));
+ g_free(pathbasename);
oldperm_flags = msginfo->flags.perm_flags;
ritem->items = g_slist_remove(ritem->items, old_item);
}
g_free(ctx->path);
+ g_free(ctx);
feed_item_free(old_item);
old_item = NULL;
}
template = g_strconcat(dirname, G_DIR_SEPARATOR_S,
RSSYL_TMP_TEMPLATE, NULL);
if ((fd = g_mkstemp(template)) < 0) {
- g_warning("Couldn't g_mkstemp('%s'), not adding message!\n", template);
+ g_warning("Couldn't g_mkstemp('%s'), not adding message!", template);
+ g_free(dirname);
g_free(template);
return;
}
f = fdopen(fd, "w");
if (f == NULL) {
- g_warning("Couldn't open file '%s', not adding message!\n", template);
+ g_warning("Couldn't open file '%s', not adding message!", template);
+ g_free(dirname);
g_free(template);
return;
}
fprintf(f, "X-RSSyl-URL: %s\n", tmpurl);
if( ritem->last_update > 0) {
- fprintf(f, "X-RSSyl-Last-Seen: %ld\n", ritem->last_update);
+ fprintf(f, "X-RSSyl-Last-Seen: %lld\n", (long long)ritem->last_update);
}
/* Message-ID */
d = folder_item_add_msg(&ritem->item, template, flags, TRUE);
g_free(template);
+ g_free(flags);
ctx = g_new0(RFeedCtx, 1);
ctx->path = (gpointer)g_strdup_printf("%s%c%d", dirname,
ctx->last_seen = ritem->last_update;
((FeedItem *)ritem->items->data)->data = (gpointer)ctx;
+ g_free(dirname);
+
/* Unset unread+new if the changed item wasn't set unread and user
* doesn't want to see it unread because of the change. */
if (dif != EXISTS_NEW) {