[glib/wip/gcleanup] gio/tests: Fix some access after free
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup] gio/tests: Fix some access after free
- Date: Fri, 8 Nov 2013 13:35:09 +0000 (UTC)
commit 0067a309fccf6e79fcf4169be3725a64920e003e
Author: Stef Walter <stefw gnome org>
Date: Fri Nov 8 14:27:56 2013 +0100
gio/tests: Fix some access after free
The memory pointed to by a GMemoryOutputStream can be realloc'd
gio/tests/buffered-output-stream.c | 4 ++++
gio/tests/data-output-stream.c | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/buffered-output-stream.c b/gio/tests/buffered-output-stream.c
index 65dec81..f3aed92 100644
--- a/gio/tests/buffered-output-stream.c
+++ b/gio/tests/buffered-output-stream.c
@@ -270,6 +270,7 @@ test_truncate(void)
g_assert_cmpint (g_memory_output_stream_get_size (base_stream), ==, len);
g_assert_cmpint (g_memory_output_stream_get_data_size (base_stream), ==, 4);
+ stream_data = g_memory_output_stream_get_data (base_stream);
g_assert_cmpint (stream_data[0], ==, 'a');
g_assert_cmpint (stream_data[1], ==, 'b');
g_assert_cmpint (stream_data[2], ==, 'c');
@@ -281,6 +282,7 @@ test_truncate(void)
g_assert (res);
g_assert_cmpint (g_memory_output_stream_get_size (base_stream), ==, 4);
g_assert_cmpint (g_memory_output_stream_get_data_size (base_stream), ==, 4);
+ stream_data = g_memory_output_stream_get_data (base_stream);
g_assert_cmpint (stream_data[0], ==, 'a');
g_assert_cmpint (stream_data[1], ==, 'b');
g_assert_cmpint (stream_data[2], ==, 'c');
@@ -292,6 +294,7 @@ test_truncate(void)
g_assert (res);
g_assert_cmpint (g_memory_output_stream_get_size (base_stream), ==, 6);
g_assert_cmpint (g_memory_output_stream_get_data_size (base_stream), ==, 4);
+ stream_data = g_memory_output_stream_get_data (base_stream);
g_assert_cmpint (stream_data[0], ==, 'a');
g_assert_cmpint (stream_data[1], ==, 'b');
g_assert_cmpint (stream_data[2], ==, 'c');
@@ -303,6 +306,7 @@ test_truncate(void)
g_assert (res);
g_assert_cmpint (g_memory_output_stream_get_size (base_stream), ==, 2);
g_assert_cmpint (g_memory_output_stream_get_data_size (base_stream), ==, 2);
+ stream_data = g_memory_output_stream_get_data (base_stream);
g_assert_cmpint (stream_data[0], ==, 'a');
g_assert_cmpint (stream_data[1], ==, 'b');
diff --git a/gio/tests/data-output-stream.c b/gio/tests/data-output-stream.c
index 2ea0cb7..98374af 100644
--- a/gio/tests/data-output-stream.c
+++ b/gio/tests/data-output-stream.c
@@ -450,6 +450,7 @@ test_truncate (void)
g_assert (res);
g_assert_cmpint (g_memory_output_stream_get_size (base_stream), ==, len);
g_assert_cmpint (g_memory_output_stream_get_data_size (base_stream), ==, 4);
+ stream_data = g_memory_output_stream_get_data (base_stream);
g_assert_cmpint (stream_data[0], ==, 0x01);
g_assert_cmpint (stream_data[1], ==, 0x23);
g_assert_cmpint (stream_data[2], ==, 0x45);
@@ -461,6 +462,7 @@ test_truncate (void)
g_assert (res);
g_assert_cmpint (g_memory_output_stream_get_size (base_stream), ==, 4);
g_assert_cmpint (g_memory_output_stream_get_data_size (base_stream), ==, 4);
+ stream_data = g_memory_output_stream_get_data (base_stream);
g_assert_cmpint (stream_data[0], ==, 0x01);
g_assert_cmpint (stream_data[1], ==, 0x23);
g_assert_cmpint (stream_data[2], ==, 0x45);
@@ -472,6 +474,7 @@ test_truncate (void)
g_assert (res);
g_assert_cmpint (g_memory_output_stream_get_size (base_stream), ==, 6);
g_assert_cmpint (g_memory_output_stream_get_data_size (base_stream), ==, 4);
+ stream_data = g_memory_output_stream_get_data (base_stream);
g_assert_cmpint (stream_data[0], ==, 0x01);
g_assert_cmpint (stream_data[1], ==, 0x23);
g_assert_cmpint (stream_data[2], ==, 0x45);
@@ -483,6 +486,7 @@ test_truncate (void)
g_assert (res);
g_assert_cmpint (g_memory_output_stream_get_size (base_stream), ==, 2);
g_assert_cmpint (g_memory_output_stream_get_data_size (base_stream), ==, 2);
+ stream_data = g_memory_output_stream_get_data (base_stream);
g_assert_cmpint (stream_data[0], ==, 0x01);
g_assert_cmpint (stream_data[1], ==, 0x23);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]