After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 683475 - A few fixes to the history service.
A few fixes to the history service.
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
unspecified
Other All
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-06 10:12 UTC by Claudio Saavedra
Modified: 2012-09-06 19:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ephy-history-service: fix a few leaks (3.22 KB, patch)
2012-09-06 10:12 UTC, Claudio Saavedra
committed Details | Review
ephy-history-service: remove some dangerous g_object_unref() calls (2.77 KB, patch)
2012-09-06 10:12 UTC, Claudio Saavedra
committed Details | Review

Description Claudio Saavedra 2012-09-06 10:12:16 UTC
There are some things that are probably wrong when dealing with possible errors.
Comment 1 Claudio Saavedra 2012-09-06 10:12:18 UTC
Created attachment 223620 [details] [review]
ephy-history-service: fix a few leaks

If there is an error processing the statement, then unref it before
returning.
Comment 2 Claudio Saavedra 2012-09-06 10:12:22 UTC
Created attachment 223621 [details] [review]
ephy-history-service: remove some dangerous g_object_unref() calls

If there is an error building a statement, the returned value is
always NULL. Calling g_object_unref() on them will lead to trouble.
Comment 3 Xan Lopez 2012-09-06 19:06:53 UTC
Review of attachment 223620 [details] [review]:

::: lib/history/ephy-history-service-hosts-table.c
@@ +78,3 @@
     g_error ("Could not insert host into hosts table: %s", error->message);
     g_error_free (error);
+    g_object_unref (statement);

There seems to be a another place in this method, the next return, that should get the same treatment? And perhaps the previous one, depending on whether the statement can be NULL if error is not NULL.

@@ +120,3 @@
     g_error ("Could not modify host in hosts table: %s", error->message);
     g_error_free (error);
+    g_object_unref (statement);

Same.

::: lib/history/ephy-history-service-urls-table.c
@@ +152,3 @@
     g_error ("Could not insert URL into urls table: %s", error->message);
     g_error_free (error);
+    g_object_unref (statement);

Same.

@@ +195,3 @@
     g_error ("Could not modify URL in urls table: %s", error->message);
     g_error_free (error);
+    g_object_unref (statement);

And same.

::: lib/history/ephy-history-service-visits-table.c
@@ +73,3 @@
     g_error ("Could not build visits table addition statement: %s", error->message);
     g_error_free (error);
+    g_object_unref (statement);

And same (basically all 'same's are about whether statement can be non-NULL if the error is set on creation).
Comment 4 Xan Lopez 2012-09-06 19:08:33 UTC
Review of attachment 223621 [details] [review]:

OK, whatever, this kinda asks my previous questions.
Comment 5 Claudio Saavedra 2012-09-06 19:35:59 UTC
Attachment 223620 [details] pushed as c514bd1 - ephy-history-service: fix a few leaks
Attachment 223621 [details] pushed as dddc036 - ephy-history-service: remove some dangerous g_object_unref() calls