From: Christian Grothoff Date: Thu, 19 Aug 2010 13:13:45 +0000 (+0000) Subject: fixing fun bug X-Git-Tag: initial-import-from-subversion-38251~20584 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=86290d22b2632f1cddeb5ae5756574d7f5dcae83;p=oweals%2Fgnunet.git fixing fun bug --- diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 21c4690bf..92cbc9747 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c @@ -116,11 +116,7 @@ GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber) */ void * GNUNET_xrealloc_ (void *ptr, -#ifndef W32_MEM_LIMIT - const size_t n, -#else size_t n, -#endif const char *filename, int linenumber) { #ifdef W32_MEM_LIMIT diff --git a/src/util/connection.c b/src/util/connection.c index eb4fe99c2..9e789eb58 100644 --- a/src/util/connection.c +++ b/src/util/connection.c @@ -1504,6 +1504,13 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) return; /* connect failed for good, we're finished */ } GNUNET_assert (sock->write_buffer_off >= sock->write_buffer_pos); + if ( (sock->nth.notify_ready != NULL) && + (sock->write_buffer_size < sock->nth.notify_size) ) + { + sock->write_buffer = GNUNET_realloc(sock->write_buffer, + sock->nth.notify_size); + sock->write_buffer_size = sock->nth.notify_size; + } process_notify (sock); have = sock->write_buffer_off - sock->write_buffer_pos; if (have == 0) @@ -1592,12 +1599,6 @@ GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle return NULL; GNUNET_assert (notify != NULL); GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE); - if (sock->write_buffer_size < size) - { - sock->write_buffer = GNUNET_realloc(sock->write_buffer, size); - sock->write_buffer_size = size; - } - GNUNET_assert (sock->write_buffer_size >= size); GNUNET_assert (sock->write_buffer_off <= sock->write_buffer_size); GNUNET_assert (sock->write_buffer_pos <= sock->write_buffer_size); GNUNET_assert (sock->write_buffer_pos <= sock->write_buffer_off);