Commit 3382eea7 authored by konstantin@oak.local's avatar konstantin@oak.local

short patch for bug #2184 'Prepared statements in embedded library was

broken with recent changes' (attempt 2).
Adding Statement_core is better because:
- set_statement() code is shorter and you don't need to modify it when adding
new members to Statement_core
- a bit faster (you don't have virtual call and don't free_root() twice)
Do that short patch instead in hope that set_statement() will be sooner or
later removed entirely
parent 60adb161
...@@ -336,6 +336,8 @@ THD::~THD() ...@@ -336,6 +336,8 @@ THD::~THD()
#ifndef DBUG_OFF #ifndef DBUG_OFF
dbug_sentry = THD_SENTRY_GONE; dbug_sentry = THD_SENTRY_GONE;
#endif #endif
/* Reset stmt_backup.mem_root to not double-free memory from thd.mem_root */
init_alloc_root(&stmt_backup.mem_root, 0, 0);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -582,8 +582,7 @@ public: ...@@ -582,8 +582,7 @@ public:
Statement_map stmt_map; Statement_map stmt_map;
/* /*
keeps THD state while it is used for active statement keeps THD state while it is used for active statement
Note, that double free_root() is safe, so we don't need to do any Note: we perform special cleanup for it in THD destructor.
special cleanup for it in THD destructor.
*/ */
Statement stmt_backup; Statement stmt_backup;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment