From 76a58e1e7e10d71ac47aa2a17e6436aca1b506fb Mon Sep 17 00:00:00 2001
From: Peter Kovacs <peter@kovax.org>
Date: Mon, 5 Aug 2013 11:44:16 -0400
Subject: Free result_metadata directly instead of freeing 2nd, redundant call.

`result_metadata` returns a new object each time it is called, so calling `result_metadata.free` is essentially a noop.  Instead call `free` directly on the metadata when we're done with it.
---
 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'activerecord')

diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index 1826d88500..fbe6ecf5f1 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -507,12 +507,12 @@ module ActiveRecord
             cols = cache[:cols] ||= metadata.fetch_fields.map { |field|
               field.name
             }
+            metadata.free
           end
 
           result_set = ActiveRecord::Result.new(cols, stmt.to_a) if cols
           affected_rows = stmt.affected_rows
 
-          stmt.result_metadata.free if cols
           stmt.free_result
           stmt.close if binds.empty?
 
-- 
cgit v1.2.3