[gedit] Plug some leaks in the unit tests.



commit 10ee3b01b476518630602e79c662584ead1c5ec7
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Mar 8 22:13:53 2010 +0100

    Plug some leaks in the unit tests.

 tests/document-input-stream.c  |    4 ++++
 tests/document-loader.c        |    5 ++++-
 tests/document-output-stream.c |    3 +++
 tests/document-saver.c         |    1 +
 4 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/tests/document-input-stream.c b/tests/document-input-stream.c
index b7bb000..bd792d6 100644
--- a/tests/document-input-stream.c
+++ b/tests/document-input-stream.c
@@ -63,6 +63,10 @@ test_consecutive_read (const gchar *inbuf,
 	b[n] = '\0';
 
 	g_assert_cmpstr (b, ==, outbuf);
+
+	g_object_unref (buf);
+	g_object_unref (in);
+	g_free (b);
 }
 
 static void
diff --git a/tests/document-loader.c b/tests/document-loader.c
index d6b6f04..e63e778 100644
--- a/tests/document-loader.c
+++ b/tests/document-loader.c
@@ -71,16 +71,19 @@ on_document_loaded (GeditDocument  *document,
                     LoaderTestData *data)
 {
 	GtkTextIter start, end;
-	gchar *text;
 
 	g_assert_no_error (error);
 
 	if (data->in_buffer != NULL)
 	{
+		gchar *text;
+
 		gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (document), &start, &end);
 		text = gtk_text_iter_get_slice (&start, &end);
 
 		g_assert_cmpstr (text, ==, data->in_buffer);
+
+		g_free (text);
 	}
 
 	if (data->newline_type != -1)
diff --git a/tests/document-output-stream.c b/tests/document-output-stream.c
index 764b625..eb57168 100644
--- a/tests/document-output-stream.c
+++ b/tests/document-output-stream.c
@@ -73,6 +73,9 @@ test_consecutive_write (const gchar *inbuf,
 	g_free (b);
 
 	g_assert (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)) == FALSE);
+
+	g_object_unref (doc);
+	g_object_unref (out);
 }
 
 static void
diff --git a/tests/document-saver.c b/tests/document-saver.c
index 1119eb6..54670d8 100644
--- a/tests/document-saver.c
+++ b/tests/document-saver.c
@@ -376,6 +376,7 @@ check_permissions (GFile *file,
 	                 ==,
 	                 g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE) & ACCESSPERMS);
 
+	g_object_unref (info);
 }
 
 static void



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