1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

Fix -Werror=nonnull in parse_sql() when trashing LEX_Parser_state

Casting thd->lex via a pointer static_cast adds a null check, so GCC
warned that memset() in TRASH_FREE might get a null argument. Cast via
a reference instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Sergei Petrunia
2026-10-15 14:57:55 +03:00
parent 197285c970
commit 28e28597bd

View File

@@ -10356,7 +10356,7 @@ bool parse_sql(THD *thd, Parser_state *parser_state,
Mark it as freed so that stale accesses are caught early. It is
brought back by LEX::start() -> LEX_Parser_state::reset_parser_state().
*/
TRASH_FREE((void*) static_cast<LEX_Parser_state*>(thd->lex),
TRASH_FREE((void*) &static_cast<LEX_Parser_state&>(*thd->lex),
sizeof(LEX_Parser_state));
/* Restore creation context. */