summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ivy/BufferedSocket.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/Ivy/BufferedSocket.cxx b/Ivy/BufferedSocket.cxx
index 3335e09..1a11c56 100644
--- a/Ivy/BufferedSocket.cxx
+++ b/Ivy/BufferedSocket.cxx
@@ -36,6 +36,7 @@ void CBufferedSocket::OnReceive(int nErrorCode)
char *ptr;
size_t nb_to_read = 0;
size_t nb;
+ char *tmp_buf;
SOCKADDR addr;
size_t len = sizeof( addr );
@@ -45,12 +46,13 @@ void CBufferedSocket::OnReceive(int nErrorCode)
if( nb_to_read == 0 )
{
buffer_size *= 2; /* twice old size */
- buffer = (char*)realloc( buffer, buffer_size );
- if (!buffer )
+ tmp_buf = (char*)realloc( buffer, buffer_size );
+ if (!tmp_buf )
{
TRACE("HandleSocket Buffer Memory Alloc Error\n");
exit(0);
}
+ buffer = tmp_buf;
TRACE( "Buffer Limit reached realloc new size %ld\n", buffer_size );
nb_to_read = buffer_size - (current_ptr - buffer );
}