summaryrefslogtreecommitdiff
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
commit0d67ea374fec5a9d740dbea0434831e6686c8d98 (patch)
treea8e778db307643414bf159799146357f3ae977d0
parenta24ca4153eb85e3a00c8c5f388bdc016a3258e27 (diff)
downloadmariadb-git-0d67ea374fec5a9d740dbea0434831e6686c8d98.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.
-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);
/*