Commit 24d19a67 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

bitvect: do not leak on realloc failure, flagged by PVS-Studio

For #192.

* spot/misc/bitvect.hh: Here.
parent 288f6ead
......@@ -26,6 +26,7 @@
#include <iosfwd>
#include <iostream>
#include <algorithm>
#include <new>
namespace spot
{
......@@ -112,8 +113,14 @@ namespace spot
}
else
{
auto old = storage_;
storage_ = static_cast<block_t*>
(realloc(storage_, new_block_count * sizeof(block_t)));
(realloc(old, new_block_count * sizeof(block_t)));
if (!storage_)
{
free(old);
throw std::bad_alloc();
}
}
block_count_ = new_block_count;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment