aboutsummaryrefslogtreecommitdiffstats
path: root/lib/history
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2012-09-06 18:07:44 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2012-09-07 03:19:58 +0800
commitc514bd1ee01d6982424e4d5eefb545fc5254a59b (patch)
tree8aeee0565d4f417617d759fdcd5ba48db3ce78d9 /lib/history
parent697dfbede122fb3e5c1847c77a7f24bc6b1bf3c5 (diff)
downloadgsoc2013-epiphany-c514bd1ee01d6982424e4d5eefb545fc5254a59b.tar
gsoc2013-epiphany-c514bd1ee01d6982424e4d5eefb545fc5254a59b.tar.gz
gsoc2013-epiphany-c514bd1ee01d6982424e4d5eefb545fc5254a59b.tar.bz2
gsoc2013-epiphany-c514bd1ee01d6982424e4d5eefb545fc5254a59b.tar.lz
gsoc2013-epiphany-c514bd1ee01d6982424e4d5eefb545fc5254a59b.tar.xz
gsoc2013-epiphany-c514bd1ee01d6982424e4d5eefb545fc5254a59b.tar.zst
gsoc2013-epiphany-c514bd1ee01d6982424e4d5eefb545fc5254a59b.zip
ephy-history-service: fix a few leaks
If there is an error processing the statement, then unref it before returning. https://bugzilla.gnome.org/show_bug.cgi?id=683475
Diffstat (limited to 'lib/history')
-rw-r--r--lib/history/ephy-history-service-hosts-table.c5
-rw-r--r--lib/history/ephy-history-service-urls-table.c2
-rw-r--r--lib/history/ephy-history-service-visits-table.c1
3 files changed, 7 insertions, 1 deletions
diff --git a/lib/history/ephy-history-service-hosts-table.c b/lib/history/ephy-history-service-hosts-table.c
index fab72947d..04be063b0 100644
--- a/lib/history/ephy-history-service-hosts-table.c
+++ b/lib/history/ephy-history-service-hosts-table.c
@@ -77,6 +77,7 @@ ephy_history_service_add_host_row (EphyHistoryService *self, EphyHistoryHost *ho
ephy_sqlite_statement_bind_double (statement, 3, host->zoom_level, &error) == FALSE) {
g_error ("Could not insert host into hosts table: %s", error->message);
g_error_free (error);
+ g_object_unref (statement);
return;
}
@@ -84,7 +85,6 @@ ephy_history_service_add_host_row (EphyHistoryService *self, EphyHistoryHost *ho
if (error) {
g_error ("Could not insert host into hosts table: %s", error->message);
g_error_free (error);
- return;
} else {
host->id = ephy_sqlite_connection_get_last_insert_id (priv->history_database);
}
@@ -118,6 +118,7 @@ ephy_history_service_update_host_row (EphyHistoryService *self, EphyHistoryHost
ephy_sqlite_statement_bind_int (statement, 4, host->id, &error) == FALSE) {
g_error ("Could not modify host in hosts table: %s", error->message);
g_error_free (error);
+ g_object_unref (statement);
return;
}
@@ -173,6 +174,8 @@ ephy_history_service_get_host_row (EphyHistoryService *self, const gchar *host_s
}
if (ephy_sqlite_statement_step (statement, &error) == FALSE) {
+ if (error)
+ g_error_free (error);
g_object_unref (statement);
return NULL;
}
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index fa1539b22..f0d445150 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -151,6 +151,7 @@ ephy_history_service_add_url_row (EphyHistoryService *self, EphyHistoryURL *url)
ephy_sqlite_statement_bind_int (statement, 5, url->host->id, &error) == FALSE) {
g_error ("Could not insert URL into urls table: %s", error->message);
g_error_free (error);
+ g_object_unref (statement);
return;
}
@@ -193,6 +194,7 @@ ephy_history_service_update_url_row (EphyHistoryService *self, EphyHistoryURL *u
ephy_sqlite_statement_bind_int (statement, 6, url->id, &error) == FALSE) {
g_error ("Could not modify URL in urls table: %s", error->message);
g_error_free (error);
+ g_object_unref (statement);
return;
}
diff --git a/lib/history/ephy-history-service-visits-table.c b/lib/history/ephy-history-service-visits-table.c
index b09c664c1..0beaa2325 100644
--- a/lib/history/ephy-history-service-visits-table.c
+++ b/lib/history/ephy-history-service-visits-table.c
@@ -72,6 +72,7 @@ ephy_history_service_add_visit_row (EphyHistoryService *self, EphyHistoryPageVis
ephy_sqlite_statement_bind_int (statement, 2, visit->visit_type, &error) == FALSE ) {
g_error ("Could not build visits table addition statement: %s", error->message);
g_error_free (error);
+ g_object_unref (statement);
return;
}