From ab24ad9c39f7604facb91e2f7d2871988906ac09 Mon Sep 17 00:00:00 2001 From: "sicking%bigfoot.com" Date: Tue, 21 Oct 2003 20:55:42 +0000 Subject: [PATCH] Bug 220703: return either error or return to avoid crashes and leaks r/sr=peterv --- extensions/transformiix/source/xpath/ExprLexer.cpp | 3 --- extensions/transformiix/source/xpath/ExprParser.cpp | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/extensions/transformiix/source/xpath/ExprLexer.cpp b/extensions/transformiix/source/xpath/ExprLexer.cpp index 7a8b75188064..f017fc5e54e0 100644 --- a/extensions/transformiix/source/xpath/ExprLexer.cpp +++ b/extensions/transformiix/source/xpath/ExprLexer.cpp @@ -125,9 +125,6 @@ txExprLexer::parse(const nsASingleFragmentString& aPattern) iterator start, end; start = aPattern.BeginReading(mPosition); aPattern.EndReading(end); - if (start == end) { - return NS_OK; - } //-- initialize previous token, this will automatically get //-- deleted when it goes out of scope diff --git a/extensions/transformiix/source/xpath/ExprParser.cpp b/extensions/transformiix/source/xpath/ExprParser.cpp index 002fab39779d..e0ed411c7637 100644 --- a/extensions/transformiix/source/xpath/ExprParser.cpp +++ b/extensions/transformiix/source/xpath/ExprParser.cpp @@ -179,9 +179,6 @@ txExprParser::createExpr(const nsASingleFragmentString& aExpression, { NS_ENSURE_ARG_POINTER(aExpr); *aExpr = nsnull; - if (aExpression.IsEmpty()) { - return NS_OK; - } txExprLexer lexer; nsresult rv = lexer.parse(aExpression); if (NS_FAILED(rv)) { @@ -192,6 +189,8 @@ txExprParser::createExpr(const nsASingleFragmentString& aExpression, } rv = createExpr(lexer, aContext, aExpr); if (NS_SUCCEEDED(rv) && lexer.peek()->mType != Token::END) { + delete *aExpr; + *aExpr = nsnull; rv = NS_ERROR_XPATH_BINARY_EXPECTED; } if (NS_FAILED(rv)) {