[glib] GSocket.receive_message: fix bogus allocation math



commit 78e8b39b49ce47a80e70319ffaf548cda177a746
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Nov 11 22:20:11 2009 -0500

    GSocket.receive_message: fix bogus allocation math

 gio/gsocket.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 8e9e07e..504cb83 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -3038,9 +3038,8 @@ g_socket_receive_message (GSocket                 *socket,
 	  if (index == allocated)
 	    {
 	      /* estimated 99% case: exactly 1 control message */
-	      allocated = MIN (allocated * 2, 1);
+	      allocated = MAX (allocated * 2, 1);
 	      my_messages = g_new (GSocketControlMessage *, (allocated + 1));
-	      allocated = 1;
 	    }
 
 	  my_messages[index++] = message;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]