use free/malloc instead of realloc in udp_socket

This commit is contained in:
Arvid Norberg 2011-02-05 09:39:15 +00:00
parent adb250cf5c
commit 4c0c322387
1 changed files with 4 additions and 2 deletions

View File

@ -198,13 +198,15 @@ void udp_socket::maybe_realloc_buffers(int which)
TORRENT_ASSERT(is_single_thread());
if (m_reallocate_buffer4 && (which & 1))
{
m_v4_buf = (char*)realloc(m_v4_buf, m_v4_buf_size);
free(m_v4_buf);
m_v4_buf = (char*)malloc(m_v4_buf_size);
m_reallocate_buffer4 = false;
}
#if TORRENT_USE_IPV6
if (m_reallocate_buffer6 && (which & 2))
{
m_v6_buf = (char*)realloc(m_v6_buf, m_v6_buf_size);
free(m_v6_buf);
m_v6_buf = (char*)malloc(m_v6_buf_size);
m_reallocate_buffer6 = false;
}
#endif