make electric fence happy by not allocating 0 bytes

This commit is contained in:
Arvid Norberg 2011-01-19 08:41:39 +00:00
parent 4693e2c94b
commit ed39e3c307
1 changed files with 2 additions and 1 deletions

View File

@ -222,6 +222,7 @@ namespace libtorrent
void resize(int bits)
{
TORRENT_ASSERT(bits >= 0);
const int b = (bits + 7) / 8;
if (m_bytes)
{
@ -238,7 +239,7 @@ namespace libtorrent
m_own = true;
}
}
else
else if (bits > 0)
{
m_bytes = (unsigned char*)std::malloc(b);
m_own = true;