From 31d376735ab2aaaed0934edcce676113f83a7de7 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sun, 21 Feb 2016 04:58:13 +0100 Subject: content-parser: fixed parser bug when handling links do not handle something like this as a valid link: [asd] asd (asd) --- src/content-parser.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/content-parser.c') diff --git a/src/content-parser.c b/src/content-parser.c index a334d28..9d4adf6 100644 --- a/src/content-parser.c +++ b/src/content-parser.c @@ -161,6 +161,16 @@ blogc_content_parse_inline(const char *src) if (c != ' ' && c != '\n' && c != '\r') spaces = 0; + if (state == LINK_TEXT_CLOSE && c != ' ' && c != '\n' && c != '\r' && + c != '(') + { + b_string_append_c(rv, src[start_state]); + tmp = blogc_content_parse_inline(src + start_state + 1); + b_string_append(rv, tmp); + // no need to free here, we will exit the loop! + break; + } + switch (c) { case '\\': @@ -390,8 +400,7 @@ blogc_content_parse_inline(const char *src) b_string_append_c(rv, src[start_state]); tmp = blogc_content_parse_inline(src + start_state + 1); b_string_append(rv, tmp); - free(tmp); - tmp = NULL; + // no need to free here, its the last iteration } current++; } -- cgit v1.2.3-18-g5258