[libgda] DbModule: Fix memory leaks



commit 8045e5f450c19b54146239a0ef28977f140dafe9
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Thu Mar 7 17:54:19 2019 -0600

    DbModule: Fix memory leaks
    
    Also fix https://gitlab.gnome.org/GNOME/libgda/issues/167

 libgda/gda-data-select.c                             |  2 +-
 libgda/gda-db-catalog.c                              | 17 ++++++++++++-----
 libgda/sqlite/gda-sqlite-provider.c                  |  2 +-
 providers/postgres/postgres_specs_create_view.xml.in |  2 +-
 providers/web/gda-web-util.c                         |  2 +-
 tools/browser/ldap-browser/ldap-classes-page.c       |  2 +-
 6 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/libgda/gda-data-select.c b/libgda/gda-data-select.c
index 2513a66a1..33feda23f 100644
--- a/libgda/gda-data-select.c
+++ b/libgda/gda-data-select.c
@@ -3106,7 +3106,7 @@ gda_data_select_append_values (GdaDataModel *model, const GList *values, GError
        }
        if (gda_data_select_get_n_rows (model) < 0) {
                g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_ACCESS_ERROR,
-                            "%s", _("Cannot add a row because the number of rows in unknown"));
+                            "%s", _("Cannot add a row because the number of rows is unknown"));
                return -1;
        }
 
diff --git a/libgda/gda-db-catalog.c b/libgda/gda-db-catalog.c
index f89400422..d82e8c787 100644
--- a/libgda/gda-db-catalog.c
+++ b/libgda/gda-db-catalog.c
@@ -1010,13 +1010,16 @@ gda_db_catalog_parse_file (GdaDbCatalog *self,
   int buffer_size = 10;
   char buffer[buffer_size];
   int ctxt_res = 0;
+  gchar *uri;
   ctxt = xmlCreatePushParserCtxt (NULL, NULL, buffer, ctxt_res, NULL);
   if (!ctxt)
     {
+      uri = g_file_get_uri (xmlfile);
       g_set_error (error,
                    GDA_DB_CATALOG_ERROR,
                    GDA_DB_CATALOG_FILE_READ,
-                   _("Can't create parse context for '%s'"), g_file_get_basename (xmlfile));
+                   _("Can't create parse context for '%s'"), uri);
+      g_free (uri);
       goto on_error;
     }
 
@@ -1031,7 +1034,7 @@ gda_db_catalog_parse_file (GdaDbCatalog *self,
           g_set_error (error,
                        GDA_DB_CATALOG_ERROR,
                        GDA_DB_CATALOG_PARSE_CHUNK,
-                       _("Error during xmlParseChunk with error '%d'"), rescheck);
+                       _("Error during parsing with error '%d'"), rescheck);
 
           goto on_error;
         }
@@ -1044,19 +1047,23 @@ gda_db_catalog_parse_file (GdaDbCatalog *self,
 
   if (!ctxt_res)
     {
+      uri = g_file_get_uri (xmlfile);
        g_set_error (error,
                     GDA_DB_CATALOG_ERROR,
                     GDA_DB_CATALOG_PARSE,
-                    _("Failed to parse file '%s'"), g_file_get_basename (xmlfile));
+                    _("Failed to parse file: '%s'"), uri);
+      g_free (uri);
       goto on_error;
     }
 
   if (!doc)
     {
+      uri = g_file_get_uri (xmlfile);
       g_set_error (error,
                    GDA_DB_CATALOG_ERROR,
                    GDA_DB_CATALOG_DOC_NULL,
-                   _("xmlDoc object can't be created from xmfile name"));
+                   _("XML Document can't be created from file: '%s'"), uri);
+      g_free (uri);
       goto on_error;
     }
 
@@ -1065,7 +1072,7 @@ gda_db_catalog_parse_file (GdaDbCatalog *self,
       g_set_error (error,
                    GDA_DB_CATALOG_ERROR,
                    GDA_DB_CATALOG_INVALID_XML,
-                   _("xml file is not valid\n"));
+                   _("XML file is not valid\n"));
       goto on_error;
     }
 
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 75a6cd3b3..07c80efc4 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -120,7 +120,7 @@ make_pending_blob (GdaServerProvider *provider, GdaConnection *cnc, GdaStatement
                if (pos == -1) {
                        g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
                                     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
-                                    _("Parameter '%s' not found is statement"), hname);
+                                    _("Parameter '%s' not found in statement"), hname);
                        goto out;
                }
                GdaSqlField *field;
diff --git a/providers/postgres/postgres_specs_create_view.xml.in 
b/providers/postgres/postgres_specs_create_view.xml.in
index 1b62511a2..6a30e4f44 100644
--- a/providers/postgres/postgres_specs_create_view.xml.in
+++ b/providers/postgres/postgres_specs_create_view.xml.in
@@ -4,7 +4,7 @@
     <parameter id="VIEW_NAME" _name="Name" _descr="View's name" gdatype="gchararray" nullok="FALSE">
       <gda_value>table_name</gda_value>
     </parameter>
-    <parameter id="VIEW_OR_REPLACE" _name="Replace it already exists" _descr="Replace view definition if it 
already exists" gdatype="gboolean" nullok="TRUE">
+    <parameter id="VIEW_OR_REPLACE" _name="Replace if already exists" _descr="Replace view definition if it 
already exists" gdatype="gboolean" nullok="TRUE">
       <gda_value>FALSE</gda_value>
     </parameter>
     <parameter id="VIEW_TEMP" _name="Temporary view" gdatype="gboolean" nullok="TRUE">
diff --git a/providers/web/gda-web-util.c b/providers/web/gda-web-util.c
index 0409cc9b9..a28359681 100644
--- a/providers/web/gda-web-util.c
+++ b/providers/web/gda-web-util.c
@@ -71,7 +71,7 @@ decode_buffer_response (GdaConnection *cnc, WebConnectionData *cdata, SoupBuffer
 
        for (ptr = response; *ptr && (*ptr != '\n'); ptr++);
        if (*ptr != '\n') {
-               gda_connection_add_event_string (cnc, _("Could not parse server's reponse"));
+               gda_connection_add_event_string (cnc, _("Could not parse server's response"));
                return NULL;
        }
        *ptr = 0;
diff --git a/tools/browser/ldap-browser/ldap-classes-page.c b/tools/browser/ldap-browser/ldap-classes-page.c
index 968ab3623..8f4c2f718 100644
--- a/tools/browser/ldap-browser/ldap-classes-page.c
+++ b/tools/browser/ldap-browser/ldap-classes-page.c
@@ -528,7 +528,7 @@ ldap_classes_customize (BrowserPage *page, GtkToolbar *toolbar, GtkHeaderBar *he
        GtkToolItem *titem;
        titem = gtk_tool_button_new (NULL, NULL);
        gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "bookmark-new-symbolic");
-       gtk_widget_set_tooltip_text (GTK_WIDGET (titem), _("Add class Favorites"));
+       gtk_widget_set_tooltip_text (GTK_WIDGET (titem), _("Add class to Favorites"));
        gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1);
        gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.AddToFav");
        gtk_widget_show (GTK_WIDGET (titem));


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