[libgda] Avoid using freed memory in GdaMetaStruct



commit 281df72c306fac882843334319141b7c4c536ace
Author: Vivien Malerba <malerba gnome-db org>
Date:   Tue Sep 29 20:32:38 2009 +0200

    Avoid using freed memory in GdaMetaStruct

 libgda/gda-meta-struct.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/libgda/gda-meta-struct.c b/libgda/gda-meta-struct.c
index bcd983c..c2300da 100644
--- a/libgda/gda-meta-struct.c
+++ b/libgda/gda-meta-struct.c
@@ -152,6 +152,7 @@ static void
 gda_meta_struct_init (GdaMetaStruct *mstruct) {
 	mstruct->priv = g_new0 (GdaMetaStructPrivate, 1);
 	mstruct->priv->store = NULL;
+	mstruct->priv->db_objects = NULL;
 	mstruct->priv->index = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 }
 
@@ -1037,7 +1038,7 @@ _meta_struct_complement (GdaMetaStruct *mstruct, GdaMetaDbObjectType type,
 
  onerror:
 	if (dbo)
-		gda_meta_db_object_free (dbo);
+		dbo->obj_type = GDA_META_DB_UNKNOWN;
 
 	return NULL;
 }
@@ -1787,6 +1788,7 @@ gda_meta_db_object_free_contents (GdaMetaDbObject *dbo)
 		TO_IMPLEMENT;
 	}
 	g_slist_free (dbo->depend_list);
+	memset (dbo, 0, sizeof (GdaMetaDbObject));
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]