[libgda] Firebird provider: avoid memleak when module is unloaded



commit 2a03b36f7216ba14576734e5619b8973a64798e8
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sat Aug 18 13:00:57 2012 +0200

    Firebird provider: avoid memleak when module is unloaded

 providers/firebird/libmain-client.c |   18 ++++++++++++++++++
 providers/firebird/libmain-embed.c  |   18 ++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/providers/firebird/libmain-client.c b/providers/firebird/libmain-client.c
index 75234d0..7682d8b 100644
--- a/providers/firebird/libmain-client.c
+++ b/providers/firebird/libmain-client.c
@@ -21,6 +21,7 @@
  */
 
 #include <glib/gi18n-lib.h>
+#include <gmodule.h>
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/binreloc/gda-binreloc.h>
 #include "gda-firebird.h"
@@ -32,6 +33,23 @@ const gchar       *plugin_get_description (void);
 gchar             *plugin_get_dsn_spec (void);
 GdaServerProvider *plugin_create_provider (void);
 
+/*
+ * Functions executed when calling g_module_open() and g_module_close()
+ */
+const gchar *
+g_module_check_init (G_GNUC_UNUSED GModule *module)
+{
+        /*g_module_make_resident (module);*/
+        return NULL;
+}
+
+void
+g_module_unload (G_GNUC_UNUSED GModule *module)
+{
+        g_free (module_path);
+        module_path = NULL;
+}
+
 void
 plugin_init (const gchar *real_path)
 {
diff --git a/providers/firebird/libmain-embed.c b/providers/firebird/libmain-embed.c
index 5499e94..3d3f423 100644
--- a/providers/firebird/libmain-embed.c
+++ b/providers/firebird/libmain-embed.c
@@ -21,6 +21,7 @@
  */
 
 #include <glib/gi18n-lib.h>
+#include <gmodule.h>
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/binreloc/gda-binreloc.h>
 #include "gda-firebird.h"
@@ -32,6 +33,23 @@ const gchar       *plugin_get_description (void);
 gchar             *plugin_get_dsn_spec (void);
 GdaServerProvider *plugin_create_provider (void);
 
+/*
+ * Functions executed when calling g_module_open() and g_module_close()
+ */
+const gchar *
+g_module_check_init (G_GNUC_UNUSED GModule *module)
+{
+        /*g_module_make_resident (module);*/
+        return NULL;
+}
+
+void
+g_module_unload (G_GNUC_UNUSED GModule *module)
+{
+        g_free (module_path);
+        module_path = NULL;
+}
+
 void
 plugin_init (const gchar *real_path)
 {



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