List:Commits« Previous MessageNext Message »
From:Rafal Somla Date:July 1 2008 1:21pm
Subject:bzr commit into mysql-6.0-backup branch (rsomla:2643)
View as plain text  
#At file:///ext/mysql/bzr/mysql-6.0-backup-pb/

 2643 Rafal Somla	2008-07-01
      Fixing some memory leaks reported by valgrind.
modified:
  sql/backup/backup_info.cc
  sql/backup/kernel.cc

per-file messages:
  sql/backup/backup_info.cc
    Delte a server object instance before starting next iteration of the loop.
  sql/backup/kernel.cc
    Store pointer to stream object in m_stream early, so that destructor has a chance to delete it also in case of errors.
=== modified file 'sql/backup/backup_info.cc'
--- a/sql/backup/backup_info.cc	2008-05-28 15:25:24 +0000
+++ b/sql/backup/backup_info.cc	2008-07-01 13:21:36 +0000
@@ -922,7 +922,10 @@ int Backup_info::add_view_deps(obs::Obj 
       base views.
      */ 
     if (res == get_dep_node_res::EXISTING_NODE)
+    {
+      delete bv; // Need to delete the instance returned by it->next().
       continue;
+    }
 
     // Recursively add all dependencies of bv to the list.
 

=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc	2008-06-30 19:40:33 +0000
+++ b/sql/backup/kernel.cc	2008-07-01 13:21:36 +0000
@@ -489,6 +489,7 @@ Backup_restore_ctx::prepare_for_backup(L
    */
 
   Output_stream *s= new Output_stream(*this, path, with_compression);
+  m_stream= s;
   
   if (!s)
   {
@@ -502,8 +503,6 @@ Backup_restore_ctx::prepare_for_backup(L
     return NULL;
   }
 
-  m_stream= s;
-
   /*
     Create backup catalogue.
    */
@@ -567,6 +566,7 @@ Backup_restore_ctx::prepare_for_restore(
 
   backup::String path(location);
   Input_stream *s= new Input_stream(*this, path);
+  m_stream= s;
   
   if (!s)
   {
@@ -580,8 +580,6 @@ Backup_restore_ctx::prepare_for_restore(
     return NULL;
   }
 
-  m_stream= s;
-
   /*
     Create restore catalogue.
    */

Thread
bzr commit into mysql-6.0-backup branch (rsomla:2643) Rafal Somla1 Jul