[libxml2] Fix Regextests
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix Regextests
- Date: Wed, 25 Sep 2019 13:51:09 +0000 (UTC)
commit 99a864a1f7a9cb59865f803770d7d62fb47cad69
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Wed Sep 25 15:27:45 2019 +0200
Fix Regextests
- One of the bug316338 test cases is expected to succeed.
- Memory leak in testRegexp.c.
- Refcount handling in xmlExpHashGetEntry.
result/regexp/bug316338 | 2 +-
testRegexp.c | 4 ++--
xmlregexp.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/result/regexp/bug316338 b/result/regexp/bug316338
index 1cd1ac0e..fcf14803 100644
--- a/result/regexp/bug316338
+++ b/result/regexp/bug316338
@@ -1,6 +1,6 @@
Regexp: (((C|c)(([\s]*\-?[0-9]+(\.[0-9]+)?((e|E)\-?[0-9]+)?){3})+[\s]*))+
C 433: Ok
-C 433 12: Fail
+C 433 12: Ok
C 433 123: Ok
C 433 123 456: Ok
C 724.64,433.12 718.08,433.12 711.52,433.12 724.64,433.12 718.08,433.12 711.52,433.12 724.64,433.12
718.08,433.12 711.52,433.12 724.64,433.12 718.08,433.12 711.52,433.12 724.64,433.12 718.08,433.12
711.52,433.12 724.64,433.12 718.08,433.12 711.52,433.12 724.64,433.12 718.08,433.12 711.52,433.12
724.64,433.12 718.08,433.12 711.52,433.12 724.64,433.12 718.08,433.12 711.52,433.12 724.64,433.12
718.08,433.12 711.52,433.12: Fail
diff --git a/testRegexp.c b/testRegexp.c
index 21dac945..21817414 100644
--- a/testRegexp.c
+++ b/testRegexp.c
@@ -185,20 +185,19 @@ static void
testReduce(xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, const char *tst) {
xmlBufferPtr xmlExpBuf;
xmlExpNodePtr sub, deriv;
- xmlExpBuf = xmlBufferCreate();
sub = xmlExpParse(ctxt, tst);
if (sub == NULL) {
printf("Subset %s failed to parse\n", tst);
return;
}
+ xmlExpBuf = xmlBufferCreate();
xmlExpDump(xmlExpBuf, sub);
printf("Subset parsed as: %s\n",
(const char *) xmlBufferContent(xmlExpBuf));
deriv = xmlExpExpDerive(ctxt, expr, sub);
if (deriv == NULL) {
printf("Derivation led to an internal error, report this !\n");
- return;
} else {
xmlBufferEmpty(xmlExpBuf);
xmlExpDump(xmlExpBuf, deriv);
@@ -210,6 +209,7 @@ testReduce(xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, const char *tst) {
(const char *) xmlBufferContent(xmlExpBuf));
xmlExpFree(ctxt, deriv);
}
+ xmlBufferFree(xmlExpBuf);
xmlExpFree(ctxt, sub);
}
diff --git a/xmlregexp.c b/xmlregexp.c
index 7d4f63ee..6825cd65 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -6629,7 +6629,7 @@ xmlExpHashGetEntry(xmlExpCtxtPtr ctxt, xmlExpNodeType type,
/* OR reduction rule 1 */
/* a | a reduced to a */
if (left == right) {
- left->ref--;
+ xmlExpFree(ctxt, right);
return(left);
}
/* OR canonicalization rule 1 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]