From 979f5abc7620fca166e9f788151bcd636e2fcb23 Mon Sep 17 00:00:00 2001 From: yu_boyun <1215979730@qq.com> Date: Thu, 26 Nov 2020 14:23:39 +0800 Subject: [PATCH] fix memleak in tidyParseBuffer --- free-attributes-before-return-NULL.patch | 27 ++++++++++++++++++++++++ tidy.spec | 9 +++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 free-attributes-before-return-NULL.patch diff --git a/free-attributes-before-return-NULL.patch b/free-attributes-before-return-NULL.patch new file mode 100644 index 0000000..945c2c7 --- /dev/null +++ b/free-attributes-before-return-NULL.patch @@ -0,0 +1,27 @@ +From 8f0e7aa22a854add9e6082ca5136e82f032a236a Mon Sep 17 00:00:00 2001 +From: lutianxiong +Date: Sun, 22 Nov 2020 00:10:12 +0800 +Subject: [PATCH] Free attributes before return NULL (#899) + +--- + src/lexer.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/lexer.c b/src/lexer.c +index 49b74f5..16a8fef 100644 +--- a/src/lexer.c ++++ b/src/lexer.c +@@ -3469,6 +3469,10 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode ) + return node; /* the COMMENT token */ + } + ++ /* check attributes before return NULL */ ++ if (attributes) ++ TY_(FreeAttribute)( doc, attributes ); ++ + DEBUG_LOG(SPRTF("Returning NULL...\n")); + return NULL; + } +-- +1.8.3.1 + diff --git a/tidy.spec b/tidy.spec index acee7bd..dbedbb4 100644 --- a/tidy.spec +++ b/tidy.spec @@ -3,7 +3,7 @@ Name: tidy Version: 5.6.0 -Release: 3 +Release: 4 Summary: Utility to clean up and pretty print HTML/XHTML/XML License: W3C URL: http://www.html-tidy.org/ @@ -11,6 +11,7 @@ Source0: https://github.com/htacg/%{upname}/archive/%{version}.tar.gz#/%{u Patch0001: 0002-Issue-656-protect-against-NULL-node-set-in-loop.patch Patch0002: fix-memleak-in-GetTokenFromStream.patch +Patch0003: free-attributes-before-return-NULL.patch BuildRequires: gcc-c++ cmake gcc libxslt pkgconfig Provides: tidy-html5 = %{version}-%{release} @@ -81,6 +82,12 @@ ln -s tidyplatform.h $RPM_BUILD_ROOT%{_includedir}/platform.h %{_mandir}/* %changelog +* Thu Nov 26 2020 yuboyun - 5.6.0-4 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix memleak in tidyParseBuffer + * Fri Nov 20 2020 lunankun - 5.6.0-3 - Type:bugfix - ID:NA -- Gitee