[tracker] tracker-tag: Fix coverity report



commit 5e8923e19a5429554bc6da4761d2874778a2f8bc
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue May 4 11:51:59 2010 +0200

    tracker-tag: Fix coverity report
    
    urns was possibly uninitialized when used. Also, removed the uris
    variable declaration inside the if (uris && *uris) block, since
    it was obviously redeclared and reused for exactly the same purpose.

 src/tracker-utils/tracker-tag.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-utils/tracker-tag.c b/src/tracker-utils/tracker-tag.c
index 4f77662..7910965 100644
--- a/src/tracker-utils/tracker-tag.c
+++ b/src/tracker-utils/tracker-tag.c
@@ -662,7 +662,7 @@ remove_tag_for_urns (TrackerClient *client,
                      GStrv          files,
                      const gchar   *tag)
 {
-	GPtrArray *urns;
+	GPtrArray *urns = NULL;
 	GError *error = NULL;
 	gchar *tag_escaped;
 	gchar *query;
@@ -675,7 +675,7 @@ remove_tag_for_urns (TrackerClient *client,
 		GPtrArray *results;
 		gchar *filter;
 		const gchar *urn;
-		GStrv uris, urns_strv;
+		GStrv urns_strv;
 
 		/* Get all tags urns */
 		query = g_strdup_printf ("SELECT ?tag "
@@ -694,6 +694,7 @@ remove_tag_for_urns (TrackerClient *client,
 			            error->message);
 			g_error_free (error);
 			g_free (tag_escaped);
+			g_strfreev (uris);
 
 			return FALSE;
 		}
@@ -703,13 +704,12 @@ remove_tag_for_urns (TrackerClient *client,
 			         _("No tags were found by that name"));
 
 			g_free (tag_escaped);
+			g_strfreev (uris);
 
 			return TRUE;
 		}
 
 		urn = * (GStrv) results->pdata[0];
-
-		uris = get_uris (files);
 		urns = get_file_urns (client, uris, urn);
 
 		if (!urns || urns->len == 0) {
@@ -759,6 +759,7 @@ remove_tag_for_urns (TrackerClient *client,
 		            _("Could not remove tag"),
 		            error->message);
 		g_error_free (error);
+		g_strfreev (uris);
 
 		return FALSE;
 	}



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