[libgda] Fix memory leak on prepared statement at GdaConnection



commit 0be091c173fb171385cf55aa8a9d458189ed19c6
Author: Daniel Espinosa <esodan gmail com>
Date:   Sun Apr 14 20:13:27 2019 -0500

    Fix memory leak on prepared statement at GdaConnection

 libgda/gda-connection.c | 1 +
 libgda/gda-set.c        | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 062c9c6cd..871abcf22 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -5984,6 +5984,7 @@ void
 _gda_prepared_estatement_free (PreparedStatementRef *ps) {
        g_object_unref (ps->statement);
        g_object_unref (ps->prepared_stmt);
+  g_free (ps);
 }
 
 /**
diff --git a/libgda/gda-set.c b/libgda/gda-set.c
index fc3a4a56a..07ceef2ff 100644
--- a/libgda/gda-set.c
+++ b/libgda/gda-set.c
@@ -1372,10 +1372,8 @@ gda_set_new_from_spec_string (const gchar *xml_spec, GError **error)
          }
     g_free (path);
     g_object_unref (file);
-         if (gda_paramlist_dtd) {
+         if (gda_paramlist_dtd != NULL) {
                  gda_paramlist_dtd->name = xmlStrdup((xmlChar*) "data-set-spec");
-    }
-    if (gda_paramlist_dtd) {
                        old_dtd = doc->intSubset;
                        doc->intSubset = gda_paramlist_dtd;
                }
@@ -1404,10 +1402,12 @@ gda_set_new_from_spec_string (const gchar *xml_spec, GError **error)
         return NULL;
     }
 #endif
-               if (gda_paramlist_dtd) {
+               if (gda_paramlist_dtd != NULL) {
                        doc->intSubset = old_dtd;
       xmlFreeDtd (gda_paramlist_dtd);
+      gda_paramlist_dtd = NULL;
     }
+    g_assert (gda_paramlist_dtd == NULL);
     xmlDoValidityCheckingDefaultValue = xmlcheck;
     g_free (validc);
   }


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