GSocket.receive_message: fix bogus allocation math

This commit is contained in:
Ryan Lortie 2009-11-11 22:20:11 -05:00
parent 409cdb8d13
commit 78e8b39b49

View File

@ -3038,9 +3038,8 @@ g_socket_receive_message (GSocket *socket,
if (index == allocated) if (index == allocated)
{ {
/* estimated 99% case: exactly 1 control message */ /* estimated 99% case: exactly 1 control message */
allocated = MIN (allocated * 2, 1); allocated = MAX (allocated * 2, 1);
my_messages = g_new (GSocketControlMessage *, (allocated + 1)); my_messages = g_new (GSocketControlMessage *, (allocated + 1));
allocated = 1;
} }
my_messages[index++] = message; my_messages[index++] = message;