[tracker/tracker-0.8] Fix several coverity reports in unit tests.



commit f9791fd13de4284135af9bdf0e39a8a25b3b67ad
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue May 4 13:59:41 2010 +0200

    Fix several coverity reports in unit tests.

 tests/libtracker-common/tracker-dbus-test.c       |    2 ++
 tests/libtracker-common/tracker-type-utils-test.c |    3 +++
 tests/libtracker-db/tracker-db-dbus-test.c        |    1 +
 tests/libtracker-extract/tracker-utils-test.c     |    1 +
 4 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/tests/libtracker-common/tracker-dbus-test.c b/tests/libtracker-common/tracker-dbus-test.c
index eb7924d..c029eb4 100644
--- a/tests/libtracker-common/tracker-dbus-test.c
+++ b/tests/libtracker-common/tracker-dbus-test.c
@@ -47,6 +47,7 @@ slist_to_strv (gboolean utf8)
 	} else {
 		if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
 			input_as_strv = tracker_dbus_slist_to_strv (input);
+			g_strfreev (input_as_strv);
 		}
 		/* Error message:
 		 *   Could not add string:'/invalid/file/\xe4\xf6\xe590808.' to GStrv, invalid UTF-8
@@ -100,6 +101,7 @@ async_queue_to_strv (gboolean utf8)
 	} else {
 		if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
 			queue_as_strv = tracker_dbus_queue_str_to_strv (queue, g_queue_get_length (queue));
+			g_strfreev (queue_as_strv);
 		}
 		/* Error message:
 		 *   Could not add string:'/invalid/file/\xe4\xf6\xe590808.' to GStrv, invalid UTF-8
diff --git a/tests/libtracker-common/tracker-type-utils-test.c b/tests/libtracker-common/tracker-type-utils-test.c
index def40d0..f22bcc9 100644
--- a/tests/libtracker-common/tracker-type-utils-test.c
+++ b/tests/libtracker-common/tracker-type-utils-test.c
@@ -289,6 +289,7 @@ test_gslist_to_string_list (void)
 
 	if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
 		result = tracker_gslist_to_string_list (NULL);
+		g_strfreev (result);
 	}
 
 	g_test_trap_assert_failed ();
@@ -344,6 +345,7 @@ test_string_list_to_string (void)
 
 	if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
 		result = tracker_string_list_to_string (NULL, 6, 'x');
+		g_free (result);
 	}
 	g_test_trap_assert_failed ();
 
@@ -417,6 +419,7 @@ test_boolean_as_text_to_number (void)
 
 	if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
 		result = tracker_string_boolean_to_string_gint (NULL);
+		g_free (result);
 	}
 	g_test_trap_assert_failed ();
 }
diff --git a/tests/libtracker-db/tracker-db-dbus-test.c b/tests/libtracker-db/tracker-db-dbus-test.c
index 9b7ff63..a740782 100644
--- a/tests/libtracker-db/tracker-db-dbus-test.c
+++ b/tests/libtracker-db/tracker-db-dbus-test.c
@@ -175,6 +175,7 @@ test_dbus_query_result_to_strv ()
 	result_set = get_mock_tracker_db_result (0, 1, FALSE);
 	if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
 		result = tracker_dbus_query_result_to_strv (result_set, 0, &count);
+		g_strfreev (result);
 	}
 	g_test_trap_assert_failed ();
 	/* Should raise g_critical (priv->array...); */
diff --git a/tests/libtracker-extract/tracker-utils-test.c b/tests/libtracker-extract/tracker-utils-test.c
index a6327d3..5782e09 100644
--- a/tests/libtracker-extract/tracker-utils-test.c
+++ b/tests/libtracker-extract/tracker-utils-test.c
@@ -81,6 +81,7 @@ test_guess_date (void)
 
 	if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
 		result = tracker_date_guess (NULL);
+		g_free (result);
 	}
 
 	g_test_trap_assert_failed ();



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