Details
Description
This test script:
DELIMITER $$;
|
--error ER_PARSE_ERROR
|
BEGIN NOT ATOMIC |
DECLARE cur CURSOR (a INT) FOR SELECT a+1; |
OPEN cur(sp_followed_by_syntax_error(); |
CLOSE cur; |
END; |
$$
|
DELIMITER ;$$
|
makes MTR complain about a memory leak:
Warning: 280 bytes lost at 0x7fe82800aba0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10752, sql/sql_parse.cc:10456
Warning: 280 bytes lost at 0x7fe82800aba0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10752, sql/sql_parse.cc:10456
This is a similar problem to MDEV-30680, but the parse error happens in a different syntax context.
The problem happens in the 10.5 tree with MDEV-30680 already pushed.
Attachments
Issue Links
- relates to
-
MDEV-30680 Warning: Memory not freed: 280 on mangled query, LeakSanitizer: detected memory leaks
-
- Closed
-
also on 10.4:
MariaDB Version 10.4.31-MariaDB-debug
==============================================================================
TEST RESULT TIME (ms) or COMMENT
--------------------------------------------------------------------------
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
BEGIN NOT ATOMIC
DECLARE cur CURSOR (a INT) FOR SELECT a+1;
OPEN cur(sp_followed_by_syntax_error();
CLOSE cur;
END;
$$
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ';
CLOSE cur;
END' at line 3
main.1_my [ pass ] 1
***Warnings generated in error logs during shutdown after running tests: main.1_my
Warning: Memory not freed: 256
Warning: 256 bytes lost at 0x61300006b8f0, allocated by T@0 at mysys/my_malloc.c:101, mysys/array.c:70, mysys/hash.c:98, sql/sp.cc:2291, sql/sp.cc:2606, sql/item_create.cc:3615, sql/item_create.cc:3461, sql/sql_yacc.yy:11513
Warning: 256 bytes lost at 0x61300006b8f0, allocated by T@0 at mysys/my_malloc.c:101, mysys/array.c:70, mysys/hash.c:98, sql/sp.cc:2291, sql/sp.cc:2606, sql/item_create.cc:3615, sql/item_create.cc:3461, sql/sql_yacc.yy:11513