[tracker] libtracker-data: Clear possible error



commit c2eaeecb47497249d08b716d4db8d5d29566ae74
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Feb 22 15:02:18 2017 +0100

    libtracker-data: Clear possible error
    
    The same GError may be reused further ahead, which would doubly free
    it as it gets non-NULL again to error handling paths.

 src/libtracker-data/tracker-data-update.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index b4390dd..9928bce 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -3452,7 +3452,8 @@ tracker_data_rollback_transaction (void)
        tracker_db_interface_execute_query (iface, &ignorable, "ROLLBACK");
 
        if (ignorable) {
-               g_error_free (ignorable);
+               g_warning ("Transaction rollback failed: %s\n", ignorable->message);
+               g_clear_error (&ignorable);
        }
 
        tracker_db_interface_execute_query (iface, NULL, "PRAGMA cache_size = %d", 
TRACKER_DB_CACHE_SIZE_DEFAULT);
@@ -3468,7 +3469,7 @@ tracker_data_rollback_transaction (void)
                         * journal file failing (in case of TRANSACTION_FORMAT_ONTOLOGY) */
                        g_warning ("Error ignored while rolling back transaction in journal: %s",
                                   ignorable->message ? ignorable->message : "No error given");
-                       g_error_free (ignorable);
+                       g_clear_error (&ignorable);
                }
 #endif /* DISABLE_JOURNAL */
 


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