throw when packet_buffer fails to allocate memory

This commit is contained in:
Arvid Norberg 2015-05-17 15:23:39 +00:00
parent c871610408
commit 9597dcda87
2 changed files with 20 additions and 17 deletions

View File

@ -157,6 +157,9 @@ namespace libtorrent {
new_size <<= 1;
void** new_storage = (void**)malloc(sizeof(void*) * new_size);
#ifndef BOOST_NO_EXCEPTIONS
if (new_storage == NULL) throw std::bad_alloc();
#endif
for (index_type i = 0; i < new_size; ++i)
new_storage[i] = 0;