From 87d66880803c9362f135d894652f6d0ed50b73bc Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 30 Mar 2015 22:32:30 -0700 Subject: Fixed memory issue. This fixes valgrind "invalid read of size 1" on input `[link](<>)`. --- src/inlines.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/inlines.c') diff --git a/src/inlines.c b/src/inlines.c index e2641a7..3e298de 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -636,7 +636,7 @@ unsigned char *cmark_clean_url(cmark_chunk *url) } cmark_strbuf_unescape(&buf); - return cmark_strbuf_detach(&buf); + return buf.size == 0 ? NULL : cmark_strbuf_detach(&buf); } unsigned char *cmark_clean_title(cmark_chunk *title) @@ -660,7 +660,7 @@ unsigned char *cmark_clean_title(cmark_chunk *title) } cmark_strbuf_unescape(&buf); - return cmark_strbuf_detach(&buf); + return buf.size == 0 ? NULL : cmark_strbuf_detach(&buf); } // Parse an autolink or HTML tag. -- cgit v1.2.3