[glib] Plug a mem leak in data-input-stream test



commit 36c7d95c9c18e36468755dc8a7cfced32170c6ca
Author: Christian Persch <chpe gnome org>
Date:   Fri Sep 3 15:47:38 2010 -0400

    Plug a mem leak in data-input-stream test
    
    ==2415== 45,045 bytes in 4,095 blocks are definitely lost in loss record 393 of 399
    ==2415==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
    ==2415==    by 0x4057094: g_malloc (gmem.c:134)
    ==2415==    by 0x417FC29: g_data_input_stream_read_line (gdatainputstream.c:797)
    ==2415==    by 0x8049874: test_read_lines (data-input-stream.c:111)
    
    ==12088== 360 bytes in 40 blocks are definitely lost in loss record 368 of 381
    ==12088==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
    ==12088==    by 0x4057094: g_malloc (gmem.c:134)
    ==12088==    by 0x417FF4C: g_data_input_stream_read_until (gdatainputstream.c:914)
    ==12088==    by 0x8049B6F: test_read_until (data-input-stream.c:182)
    
    Bug #628331.

 gio/tests/data-input-stream.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/data-input-stream.c b/gio/tests/data-input-stream.c
index dcbcd3d..2de5bb9 100644
--- a/gio/tests/data-input-stream.c
+++ b/gio/tests/data-input-stream.c
@@ -112,9 +112,12 @@ test_read_lines (GDataStreamNewlineType newline_type)
       if (data)
 	{
 	  g_assert_cmpstr (data, ==, lines[line]);
+          g_free (data);
 	  g_assert_no_error (error);
 	  line++;
 	}
+      if (error)
+        g_error_free (error);
     }
   g_assert_cmpint (line, ==, MAX_LINES);
   
@@ -180,6 +183,7 @@ test_read_until (void)
       if (data)
 	{
 	  g_assert_cmpint (strlen (data), ==, DATA_PART_LEN);
+          g_free (data);
 	  g_assert_no_error (error);
 	  line++;
 	}



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