GNOME Bugzilla – Bug 738170
g_byte_array_new_take() doesn't initialize array->alloc
Last modified: 2014-10-09 05:54:14 UTC
Created attachment 288070 [details] Test case g_byte_array_new_take() should initialize array->alloc (the internally tracked size of the real allocation). If array->alloc is not initialized, running g_byte_array_set_size() under gc-friendly will actually fully clear the whole internal array, not just the extra allocated size... :/ Attached test case. Without the patch, running under gc-friendly makes the test crash. $ ./test $ G_DEBUG=gc-friendly ./test ** ERROR:test.c:21:main: assertion failed: (array->data[0] == 0xAB)
Created attachment 288071 [details] [review] Patch
Review of attachment 288071 [details] [review]: Nice catch. Please commit.