diff options
author | Monty <monty@mariadb.org> | 2015-07-05 12:40:16 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2015-07-05 12:40:16 +0300 |
commit | 8d4d185a08cd758d552d233c26f68af4caa28388 (patch) | |
tree | 4337b5a92c3bbc7d1398c6721f143eabb44ead25 /sql | |
parent | 86377d078ef130d3da32c5da31131e519822e139 (diff) | |
download | mariadb-git-8d4d185a08cd758d552d233c26f68af4caa28388.tar.gz |
Simple optimization and removal of compiler warnings
Diffstat (limited to 'sql')
-rw-r--r-- | sql/filesort.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index 4e8273e27d2..cacc63cd70e 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -447,10 +447,11 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, void filesort_free_buffers(TABLE *table, bool full) { DBUG_ENTER("filesort_free_buffers"); + my_free(table->sort.record_pointers); table->sort.record_pointers= NULL; - if (full) + if (unlikely(full)) { table->sort.free_sort_buffer(); my_free(table->sort.buffpek); @@ -458,10 +459,14 @@ void filesort_free_buffers(TABLE *table, bool full) table->sort.buffpek_len= 0; } - my_free(table->sort.addon_buf); - my_free(table->sort.addon_field); - table->sort.addon_buf= NULL; - table->sort.addon_field= NULL; + /* addon_buf is only allocated if addon_field is set */ + if (unlikely(table->sort.addon_field)) + { + my_free(table->sort.addon_field); + my_free(table->sort.addon_buf); + table->sort.addon_buf= NULL; + table->sort.addon_field= NULL; + } DBUG_VOID_RETURN; } |