summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Shchepa <gleb.shchepa@oracle.com>2019-05-20 10:53:00 +0400
committerSergei Golubchik <serg@mariadb.org>2019-07-24 18:32:24 +0200
commit7473a71a282c47a1e95359c575089c8ef51caf56 (patch)
tree862b5a0d38ea69707c8d27ab2c3b3f0017086d95
parent8ddb7e3eb71010decd5acc99aa98c82bbe0139aa (diff)
downloadmariadb-git-7473a71a282c47a1e95359c575089c8ef51caf56.tar.gz
Bug #29419820: MEMORY LEAK IN MY_YYOVERFLOW()
Note: this patch is for 5.6. Detected by ASAN. The patch fixes the cleanup of parser stack pointers. Reviewed-by: Guilhem Bichot <guilhem.bichot@oracle.com>
-rw-r--r--sql/sql_lex.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 8f629750198..2410f6edc23 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2010, 2018, MariaDB Corporation
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2019, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2858,15 +2858,18 @@ public:
class Yacc_state
{
public:
- Yacc_state()
- {
- reset();
- }
+ Yacc_state() : yacc_yyss(NULL), yacc_yyvs(NULL) { reset(); }
void reset()
{
- yacc_yyss= NULL;
- yacc_yyvs= NULL;
+ if (yacc_yyss != NULL) {
+ my_free(yacc_yyss);
+ yacc_yyss = NULL;
+ }
+ if (yacc_yyvs != NULL) {
+ my_free(yacc_yyvs);
+ yacc_yyvs = NULL;
+ }
m_set_signal_info.clear();
m_lock_type= TL_READ_DEFAULT;
m_mdl_type= MDL_SHARED_READ;