Permalink
Browse files

Fix #412, leakage on length(<expression>)

Several examples of the affected clause in one query from test 253:

select length(curtime()) a,length(utc_time()) b, length(utc_timestamp()) c, length(timediff(curtime(),utc_timestamp())) d, a+b+c+d e from test where match('title') and e>0;

(cherry picked from commit 2d2a18eccde496df408a2046102ad07ff2f44e70)
  • Loading branch information...
klirichek committed Aug 23, 2018
1 parent 43fca3a commit 9154b18eaed5302e8330cb3a95bd968959ccb312
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/sphinxexpr.cpp
@@ -852,8 +852,10 @@ class Expr_StrLength_c : public Expr_Unary_c
int IntEval ( const CSphMatch & tMatch ) const final
{
const BYTE * pStr;
return m_pFirst->StringEval ( tMatch, &pStr );
const BYTE * pStr = nullptr;
int iLen = m_pFirst->StringEval ( tMatch, &pStr );
if ( m_pFirst->IsDataPtrAttr () ) SafeDeleteArray ( pStr );
return iLen;
}
float Eval ( const CSphMatch & tMatch ) const final { return (float)IntEval ( tMatch ); }

0 comments on commit 9154b18

Please sign in to comment.