summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-07-09 15:05:30 +0300
committerGeorgi Kodinov <joro@sun.com>2009-07-09 15:05:30 +0300
commit4b6f5f530f06300a06794d41c96f412cf11325a7 (patch)
tree6471695f7f28998a91b1795b6d63ac65a05e53cd /sql/opt_range.cc
parent6e6bdb55233b026499903909d1767717002b4a92 (diff)
downloadmariadb-git-4b6f5f530f06300a06794d41c96f412cf11325a7.tar.gz
Bug #45962: memory leak after 'sort aborted' errors
When the function exits with an error it was not freeing the local Unique class instance. Fixed my making sure all the places where the function returns from are freeing the Unique instance
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index e3aef02637f..47067c03a85 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -8065,7 +8065,10 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
if (cur_quick->file->inited != handler::NONE)
cur_quick->file->ha_index_end();
if (cur_quick->init() || cur_quick->reset())
+ {
+ delete unique;
DBUG_RETURN(1);
+ }
}
if (result)
@@ -8073,13 +8076,17 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
if (result != HA_ERR_END_OF_FILE)
{
cur_quick->range_end();
+ delete unique;
DBUG_RETURN(result);
}
break;
}
if (thd->killed)
+ {
+ delete unique;
DBUG_RETURN(1);
+ }
/* skip row if it will be retrieved by clustered PK scan */
if (pk_quick_select && pk_quick_select->row_in_ranges())
@@ -8088,8 +8095,10 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
cur_quick->file->position(cur_quick->record);
result= unique->unique_add((char*)cur_quick->file->ref);
if (result)
+ {
+ delete unique;
DBUG_RETURN(1);
-
+ }
}
/*