GNOME Bugzilla – Bug 686091
Invalid reads in g_bytes_unref_to_data
Last modified: 2012-10-17 09:42:45 UTC
In g_bytes_unref_to_data there were invalid reads when first calling try_steal_and_unref and then using the unreferenced 'bytes'. There were also a double free when bytes->data was NULL. This is a proposed fix
Forgotten patch ?
Created attachment 226407 [details] [review] Proposed fix
I don't follow. If try_steal_and_unref returns NULL, no unref has happened. Do you have a testcase that shows the claimed invalid reads or double frees ?
For the double free, if bytes->ref_count is 1 and bytes->data is NULL there is a free in try_steal_and_unref and then there is another free because result == NULL For the invalid reads it is similar, result == NULL and the "bytes" structure is accessed for duplicating the data.