Bug 616877 – Several issues with g_socket_receive_message
authorDavid Zeuthen <davidz@redhat.com>
Mon, 26 Apr 2010 20:37:02 +0000 (16:37 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 26 Apr 2010 23:19:17 +0000 (19:19 -0400)
commit3ceddd74bb4304e4e9b2e8955b80212108703632
tree11ef5e525a488acea07b234616132ceb415aea55
parentcd062e841fecd51845b4a66473c7636706021dff
Bug 616877 – Several issues with g_socket_receive_message

The messages array was not reallocated correctly because it was using
malloc instead of realloc. Also, if the user requested messages but
none were received we would segfault. Rewrite the code to fix this
and, for better readability, use GPtrArray instead of rolling our own.

Also make the docs mention that the user need to free the returned
GSocketControlMessage objects using g_object_unref().

Clarify that *messages may be set to %NULL if there are no messages
(this will save pointless allocs of arrays).

Finally, the Win32 version didn't set messages to the expected value.

https://bugzilla.gnome.org/show_bug.cgi?id=616877

Signed-off-by: David Zeuthen <davidz@redhat.com>
gio/gsocket.c