#At file:///ext/mysql/bzr/mysql-6.0-backup-pb/
2648 Rafal Somla 2008-07-05
Fixing PB problems:
- undefined constant _S_IFIFO in windows build
- memory leak in si_objects.cc
- compiler warning
modified:
include/config-win.h
sql/si_objects.cc
sql/si_objects.h
per-file messages:
include/config-win.h
Added #include <stat.h> needed for definition of _S_IFIFO constant
sql/si_objects.cc
- Added parentheses to remove compilation warning
- Implementation of Name_locker::free_table_list()
sql/si_objects.h
Added code to free all memory allocated in m_table_list.
=== modified file 'include/config-win.h'
--- a/include/config-win.h 2008-07-02 11:27:17 +0000
+++ b/include/config-win.h 2008-07-05 08:41:26 +0000
@@ -35,6 +35,7 @@
#include <fcntl.h>
#include <io.h>
#include <malloc.h>
+#include <stat.h>
#define HAVE_SMEM 1
=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc 2008-07-02 11:41:05 +0000
+++ b/sql/si_objects.cc 2008-07-05 08:41:26 +0000
@@ -3122,7 +3122,7 @@ TABLE_LIST *Name_locker::build_table_lis
DBUG_ENTER("Name_locker::build_table_list()");
List_iterator<Obj> it(*tables);
- while (tbl= it++)
+ while ((tbl= it++))
{
TABLE_LIST *ptr= (TABLE_LIST*)my_malloc(sizeof(TABLE_LIST), MYF(MY_WME));
DBUG_ASSERT(ptr); // FIXME: report error instead
@@ -3143,6 +3143,18 @@ TABLE_LIST *Name_locker::build_table_lis
DBUG_RETURN(tl);
}
+void Name_locker::free_table_list(TABLE_LIST *tl)
+{
+ TABLE_LIST *ptr= tl;
+
+ while (ptr)
+ {
+ tl= tl->next_global;
+ my_free(ptr, MYF(0));
+ ptr= tl;
+ }
+}
+
/**
Gets name locks on table list.
=== modified file 'sql/si_objects.h'
--- a/sql/si_objects.h 2008-06-25 13:59:45 +0000
+++ b/sql/si_objects.h 2008-07-05 08:41:26 +0000
@@ -614,7 +614,11 @@ class Name_locker
{
public:
Name_locker(THD *thd) { m_thd= thd; }
- ~Name_locker() { my_free(m_table_list, MYF(0)); }
+ ~Name_locker()
+ {
+ free_table_list(m_table_list);
+ m_table_list= NULL;
+ }
/*
Gets name locks on table list.
@@ -634,6 +638,7 @@ private:
Builds a table list from the list of objects passed to constructor.
*/
TABLE_LIST *build_table_list(List<Obj> *tables, thr_lock_type lock);
+ void free_table_list(TABLE_LIST*);
};
} // obs namespace
| Thread |
|---|
| • bzr commit into mysql-6.0-backup branch (rsomla:2648) | Rafal Somla | 5 Jul |