Skip to content

Commit

Permalink
BUG#31650096: MYSQL SERVER HEAP-USE-AFTER-FREE IN
Browse files Browse the repository at this point in the history
              TRANS_SAVEPOINT

ANALYSIS:
=========
During Bootstrap, while executing the statements from sql
file passed to the init-file server option, transaction
mem_root was being freed for every statement. This creates
an issue with multi statement transactions especially when a
statement in the transaction has to access the memory used
by the previous statement in the transaction.

FIX:
====
Transaction mem_root is freed whenever a transaction is
committed or rolled-back. Hence explicitly freeing it is not
necessary in the bootstrap implementation.

Change-Id: I40f71d49781bf7ad32d474bb176bd6060c9377dc
  • Loading branch information
karthik-kamath committed Aug 31, 2020
1 parent e2a46b4 commit e453966
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,6 @@ static void handle_bootstrap_impl(THD *thd)
break;

free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
}

DBUG_VOID_RETURN;
Expand Down

0 comments on commit e453966

Please sign in to comment.