MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Ramil Kalimullin Date:September 29 2010 4:10pm
Subject:bzr commit into mysql-5.1-bugteam branch (ramil:3519) Bug#56382
View as plain text  
#At file:///home/ram/mysql/b56382-5.1-bugteam/ based on revid:davi.arnaut@stripped

 3519 Ramil Kalimullin	2010-09-29
      Fix for bug #56382: valgrind leak warning from main.loaddata
      
      Problem: a buffer allocated for LOAD DATA is not freed 
      under some circumstances (e.g. if an error occured).
      
      Fix: always free the buffer allocated.
     @ sql/sql_load.cc
        Fix for bug #56382: valgrind leak warning from main.loaddata
          - always free previously allocated READ_INFO::buffer 
        in its destructor.

    modified:
      sql/sql_load.cc
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc	2010-08-03 02:22:19 +0000
+++ b/sql/sql_load.cc	2010-09-29 16:10:12 +0000
@@ -1067,7 +1067,7 @@ READ_INFO::READ_INFO(File file_par, uint
 		     String &field_term, String &line_start, String &line_term,
 		     String &enclosed_par, int escape, bool get_it_from_net,
 		     bool is_fifo)
-  :file(file_par),escape_char(escape)
+  :file(file_par), buffer(0), escape_char(escape)
 {
   read_charset= cs;
   field_term_ptr=(char*) field_term.ptr();
@@ -1116,6 +1116,7 @@ READ_INFO::READ_INFO(File file_par, uint
 		      MYF(MY_WME)))
     {
       my_free((uchar*) buffer,MYF(0)); /* purecov: inspected */
+      buffer= 0;
       error=1;
     }
     else
@@ -1146,9 +1147,13 @@ READ_INFO::~READ_INFO()
   {
     if (need_end_io_cache)
       ::end_io_cache(&cache);
-    my_free((uchar*) buffer,MYF(0));
     error=1;
   }
+  if (buffer)
+  {
+    my_free((uchar*) buffer, MYF(0));
+    buffer= 0;
+  }
 }
 
 


Attachment: [text/bzr-bundle] bzr/ramil@mysql.com-20100929161012-wp5y57cw2lbjjq7c.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (ramil:3519) Bug#56382Ramil Kalimullin29 Sep