Commit 0d67ea37 authored by Raghav Kapoor's avatar Raghav Kapoor

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.
parent a24ca415
...@@ -523,7 +523,10 @@ int mysql_update(THD *thd, ...@@ -523,7 +523,10 @@ int mysql_update(THD *thd,
/* If quick select is used, initialize it before retrieving rows. */ /* If quick select is used, initialize it before retrieving rows. */
if (select && select->quick && select->quick->reset()) if (select && select->quick && select->quick->reset())
{
close_cached_file(&tempfile);
goto err; goto err;
}
table->file->try_semi_consistent_read(1); table->file->try_semi_consistent_read(1);
/* /*
......
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