From 64e5421bb2a0dbad5d23a6c292d84a96cb3050e2 Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Sun, 17 May 2015 19:13:17 +0200 Subject: [PATCH] RSSyl: Strip leading and trailing whitespace from XML tag contents. --- src/plugins/rssyl/libfeed/parser_atom10.c | 3 ++- src/plugins/rssyl/libfeed/parser_rdf.c | 3 ++- src/plugins/rssyl/libfeed/parser_rss20.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/rssyl/libfeed/parser_atom10.c b/src/plugins/rssyl/libfeed/parser_atom10.c index f3a9e0d7b..9cf4ffa8c 100644 --- a/src/plugins/rssyl/libfeed/parser_atom10.c +++ b/src/plugins/rssyl/libfeed/parser_atom10.c @@ -107,7 +107,7 @@ void feed_parser_atom10_end(void *data, const gchar *el) gchar *text = NULL, *tmp; if( ctx->str != NULL ) - text = ctx->str->str; + text = g_strstrip(g_strdup(ctx->str->str)); else text = ""; @@ -253,6 +253,7 @@ void feed_parser_atom10_end(void *data, const gchar *el) } if( ctx->str != NULL ) { + g_free(text); g_string_free(ctx->str, TRUE); ctx->str = NULL; } diff --git a/src/plugins/rssyl/libfeed/parser_rdf.c b/src/plugins/rssyl/libfeed/parser_rdf.c index 02b80ea68..d514bf0b1 100644 --- a/src/plugins/rssyl/libfeed/parser_rdf.c +++ b/src/plugins/rssyl/libfeed/parser_rdf.c @@ -57,7 +57,7 @@ void feed_parser_rdf_end(void *data, const gchar *el) gchar *text = NULL; if( ctx->str != NULL ) - text = ctx->str->str; + text = g_strstrip(g_strdup(ctx->str->str)); else text = ""; @@ -142,6 +142,7 @@ void feed_parser_rdf_end(void *data, const gchar *el) } if( ctx->str != NULL ) { + g_free(text); g_string_free(ctx->str, TRUE); ctx->str = NULL; } diff --git a/src/plugins/rssyl/libfeed/parser_rss20.c b/src/plugins/rssyl/libfeed/parser_rss20.c index 25cea33d8..1ce30ab5f 100644 --- a/src/plugins/rssyl/libfeed/parser_rss20.c +++ b/src/plugins/rssyl/libfeed/parser_rss20.c @@ -80,7 +80,7 @@ void feed_parser_rss20_end(void *data, const gchar *el) gchar *text = NULL; if( ctx->str != NULL ) - text = ctx->str->str; + text = g_strstrip(g_strdup(ctx->str->str)); else text = ""; @@ -174,6 +174,7 @@ void feed_parser_rss20_end(void *data, const gchar *el) } if( ctx->str != NULL ) { + g_free(text); g_string_free(ctx->str, TRUE); ctx->str = NULL; } -- 2.25.1