diff options
Diffstat (limited to 'src/server/Buffer.cpp')
-rw-r--r-- | src/server/Buffer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index ea3205fb..68b75931 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -172,7 +172,12 @@ void Buffer::resize(uint32_t capacity) { if (!_external) { - _buf = realloc(_buf, capacity); + void* const new_buf = realloc(_buf, capacity); + if (!new_buf) { + throw std::bad_alloc{}; + } + + _buf = new_buf; _capacity = capacity; clear(); } else { |