[tracker/wip/carlosg/coverity-warnings: 10/18] libtracker-data: Plug leak




commit f81a1f8bc6aca607d8cf9722e813617d52f0b188
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Mar 20 13:09:11 2021 +0100

    libtracker-data: Plug leak
    
    The "expr" variable was being leaked in some error paths.
    
    CID: #1501122

 src/libtracker-data/tracker-data-manager.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 7f7a0eb54..e7d472c8b 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -405,10 +405,8 @@ set_index_for_multi_value_property (TrackerDBInterface  *iface,
                                                    service_name,
                                                    field_name);
 
-               if (internal_error) {
-                       g_propagate_error (error, internal_error);
-                       return;
-               }
+               if (internal_error)
+                       goto out;
 
                TRACKER_NOTE (ONTOLOGY_CHANGES,
                              g_message ("Creating index (multi-value property): "
@@ -424,10 +422,8 @@ set_index_for_multi_value_property (TrackerDBInterface  *iface,
                                                    field_name,
                                                    expr);
 
-               if (internal_error) {
-                       g_propagate_error (error, internal_error);
-                       return;
-               }
+               if (internal_error)
+                       goto out;
        } else {
                TRACKER_NOTE (ONTOLOGY_CHANGES,
                              g_message ("Creating index (multi-value property): "
@@ -443,9 +439,13 @@ set_index_for_multi_value_property (TrackerDBInterface  *iface,
                                                    field_name,
                                                    expr);
 
-               if (internal_error) {
-                       g_propagate_error (error, internal_error);
-               }
+               if (internal_error)
+                       goto out;
+       }
+
+out:
+       if (internal_error) {
+               g_propagate_error (error, internal_error);
        }
 
        g_free (expr);


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