List:Commits« Previous MessageNext Message »
From:Ignacio Galarza Date:March 20 2007 3:34pm
Subject:bk commit into 5.0 tree (iggy:1.2403) BUG#23736
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of iggy. When iggy does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-03-20 10:34:25-04:00, iggy@recycle.(none) +4 -0
  Bug#23736 Pointer free error in mysqlbinlog
  - Mis-matched SAFEMALLOC defines caused misleading error message.

  client/mysqlbinlog.cc@stripped, 2007-03-20 10:34:23-04:00, iggy@recycle.(none) +13 -14
    Bug#23736 Pointer free error in mysqlbinlog
    - Re-worked the Load_log_processor so that it frees it's resources before 
    my_end is called.  This is necessary because SAFEMALLOC's _my_free calls
    pthread_mutex_lock() using THR_LOCK_malloc which is cleaned up in my_end().

  include/my_sys.h@stripped, 2007-03-20 10:34:23-04:00, iggy@recycle.(none) +9 -8
    Bug#23736 Pointer free error in mysqlbinlog
    - Define DYNAMIC_ARRAY beofore MY_TMPDIR
    - Add DYNAMIC_ARRAY to MY_TMP_DIR

  mysys/array.c@stripped, 2007-03-20 10:34:23-04:00, iggy@recycle.(none) +0 -4
    Bug#23736 Pointer free error in mysqlbinlog
    - SAFEMALLOC should not be unconditionally undef'd.

  mysys/mf_tempdir.c@stripped, 2007-03-20 10:34:23-04:00, iggy@recycle.(none) +6 -7
    Bug#23736 Pointer free error in mysqlbinlog
    - Use struct's DYNAMIC_ARRAY.
    - Use DYNAMIC_ARRAY:delete_dynamic function instead of my_free

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	iggy
# Host:	recycle.(none)
# Root:	/src/bug23736/my50-bug23736

--- 1.193/include/my_sys.h	2007-01-22 07:10:36 -05:00
+++ 1.194/include/my_sys.h	2007-03-20 10:34:23 -04:00
@@ -322,22 +322,23 @@
 
 extern struct st_my_file_info *my_file_info;
 
+typedef struct st_dynamic_array
+{
+  char *buffer;
+  uint elements,max_element;
+  uint alloc_increment;
+  uint size_of_element;
+} DYNAMIC_ARRAY;
+
 typedef struct st_my_tmpdir
 {
+  DYNAMIC_ARRAY full_list;
   char **list;
   uint cur, max;
 #ifdef THREAD
   pthread_mutex_t mutex;
 #endif
 } MY_TMPDIR;
-
-typedef struct st_dynamic_array
-{
-  char *buffer;
-  uint elements,max_element;
-  uint alloc_increment;
-  uint size_of_element;
-} DYNAMIC_ARRAY;
 
 typedef struct st_dynamic_string
 {

--- 1.12/mysys/array.c	2006-12-23 14:04:07 -05:00
+++ 1.13/mysys/array.c	2007-03-20 10:34:23 -04:00
@@ -15,10 +15,6 @@
 
 /* Handling of arrays that can grow dynamicly. */
 
-#if defined(WIN32) || defined(__WIN__)
-#undef SAFEMALLOC				/* Problems with threads */
-#endif
-
 #include "mysys_priv.h"
 #include "m_string.h"
 

--- 1.135/client/mysqlbinlog.cc	2007-01-22 07:10:36 -05:00
+++ 1.136/client/mysqlbinlog.cc	2007-03-20 10:34:23 -04:00
@@ -155,11 +155,7 @@
 
 public:
   Load_log_processor() {}
-  ~Load_log_processor()
-  {
-    destroy();
-    delete_dynamic(&file_names);
-  }
+  ~Load_log_processor() {}
 
   int init()
   {
@@ -179,20 +175,22 @@
       target_dir_name_len= strlen(target_dir_name);
     }
   void destroy()
+  {
+    File_name_record *ptr= (File_name_record *)file_names.buffer;
+    File_name_record *end= ptr + file_names.elements;
+    for (; ptr < end; ptr++)
     {
-      File_name_record *ptr= (File_name_record *)file_names.buffer;
-      File_name_record *end= ptr + file_names.elements;
-      for (; ptr<end; ptr++)
+      if (ptr->fname)
       {
-	if (ptr->fname)
-	{
-          my_free(ptr->fname, MYF(MY_WME));
-          delete ptr->event;
-          bzero((char *)ptr, sizeof(File_name_record));
-	}
+        my_free(ptr->fname, MYF(MY_WME));
+        delete ptr->event;
+        bzero((char *)ptr, sizeof(File_name_record));
       }
     }
 
+    delete_dynamic(&file_names);
+  }
+
   /*
     Obtain Create_file event for LOAD DATA statement by its file_id.
 
@@ -1517,6 +1515,7 @@
   cleanup();
   free_defaults(defaults_argv);
   my_free_open_file_info();
+  load_processor.destroy();
   /* We cannot free DBUG, it is used in global destructors after exit(). */
   my_end(MY_DONT_FREE_DBUG);
   exit(exit_value);

--- 1.5/mysys/mf_tempdir.c	2006-12-23 14:04:07 -05:00
+++ 1.6/mysys/mf_tempdir.c	2007-03-20 10:34:23 -04:00
@@ -26,9 +26,8 @@
 {
   char *end, *copy;
   char buff[FN_REFLEN];
-  DYNAMIC_ARRAY t_arr;
   pthread_mutex_init(&tmpdir->mutex, MY_MUTEX_INIT_FAST);
-  if (my_init_dynamic_array(&t_arr, sizeof(char*), 1, 5))
+  if (my_init_dynamic_array(&tmpdir->full_list, sizeof(char*), 1, 5))
     return TRUE;
   if (!pathlist || !pathlist[0])
   {
@@ -49,14 +48,14 @@
     convert_dirname(buff, pathlist, end);
     if (!(copy=my_strdup(buff, MYF(MY_WME))))
       return TRUE;
-    if (insert_dynamic(&t_arr, (gptr)&copy))
+    if (insert_dynamic(&tmpdir->full_list, (gptr)&copy))
       return TRUE;
     pathlist=end+1;
   }
   while (*end);
-  freeze_size(&t_arr);
-  tmpdir->list=(char **)t_arr.buffer;
-  tmpdir->max=t_arr.elements-1;
+  freeze_size(&tmpdir->full_list);
+  tmpdir->list=(char **)tmpdir->full_list.buffer;
+  tmpdir->max=tmpdir->full_list.elements-1;
   tmpdir->cur=0;
   return FALSE;
 }
@@ -76,7 +75,7 @@
   uint i;
   for (i=0; i<=tmpdir->max; i++)
     my_free(tmpdir->list[i], MYF(0));
-  my_free((gptr)tmpdir->list, MYF(0));
+  delete_dynamic(&tmpdir->full_list);
   pthread_mutex_destroy(&tmpdir->mutex);
 }
 
Thread
bk commit into 5.0 tree (iggy:1.2403) BUG#23736Ignacio Galarza20 Mar