summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorRaghav Kapoor <raghav.kapoor@oracle.com>2013-04-08 15:25:45 +0530
committerRaghav Kapoor <raghav.kapoor@oracle.com>2013-04-08 15:25:45 +0530
commitb170dff8ba570fd1e7e1c1b6dfe9dbb00f4cf58f (patch)
treea8e778db307643414bf159799146357f3ae977d0 /sql/sql_update.cc
parent7ffee64f2db2645e9c365709f53ff34356c798da (diff)
downloadmariadb-git-b170dff8ba570fd1e7e1c1b6dfe9dbb00f4cf58f.tar.gz
BUG#15978766 - TEST VALGRIND_REPORT FAILS INNODB TESTS
BACKGROUND: The testcase i_innodb.innodb_bug14036214 when run under valgrind leaks memory. ANALYSIS: In the code path of mysql_update, a temporary file is opened using open_cached_file(). When an error has occured in that code path, this temporary file was not closed since call to close_cached_file() was missing. This problem exists in 5.5 but it does not exists in 5.6 and trunk. This is because in 5.6 and trunk, when we issue the update statement in the test case, it does not take the same code path as in 5.5. The code path is different because a different plan is chosen by optimizer. See Bug#14036214 for details. However, the problem can still be examined in 5.6 and trunk by code inspection. FIX: The file opened by open_cached_file() has been closed by calling close_cached_file() when an error occurs so that it does not results in a memory leak.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index e7600fe248e..5bc11e942f6 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -523,7 +523,10 @@ int mysql_update(THD *thd,
/* If quick select is used, initialize it before retrieving rows. */
if (select && select->quick && select->quick->reset())
+ {
+ close_cached_file(&tempfile);
goto err;
+ }
table->file->try_semi_consistent_read(1);
/*