From 8dd9a4ca27f822cc5255d1d33148d3ad8ddccf6c Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 9 Mar 2020 15:24:20 +0200 Subject: [PATCH] MXS-2917 Add missing destructors to sqlite rules Lemon (the sqlite parser generator) destructors are needed for all rules that return dynamically allocated structures. Otherwise there may be leaks if a statement is not completely parsed. --- query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y | 2 ++ 1 file changed, 2 insertions(+) diff --git a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y index d95a721a8..538a97076 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y @@ -1878,6 +1878,7 @@ expr(A) ::= LP(B) expr(X) RP(E). {A.pExpr = X.pExpr; spanSet(&A,&B,&E);} %endif %ifdef MAXSCALE %type exprs {ExprSpan} +%destructor exprs {sqlite3ExprDelete(pParse->db, $$.pExpr);} exprs(A) ::= expr(X). { A = X; } exprs(A) ::= exprs(X) COMMA(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);} expr(A) ::= LP(B) exprs(X) RP(E). {A.pExpr = X.pExpr; spanSet(&A,&B,&E);} @@ -2908,6 +2909,7 @@ cmd ::= DROP DATABASE ifexists id(X). { cmd ::= call. %type call_args_opt {ExprList*} +%destructor call_args_opt {sqlite3ExprListDelete(pParse->db, $$);} call_args_opt(A) ::= . {A=0;} call_args_opt(A) ::= LP exprlist(X) RP. {A=X;}