[test] fix a leak

This commit is contained in:
Timothy Stack 2021-06-03 05:54:13 +00:00
parent d3d527d290
commit 76ce111d48
2 changed files with 4 additions and 0 deletions

View File

@ -183,6 +183,9 @@ public:
}
void expand_by(size_t amount) {
if (amount == 0) {
return;
}
auto new_size = this->ab_size + amount;
auto new_buffer = (char *) realloc(this->ab_buffer, new_size);

View File

@ -78,6 +78,7 @@ Result<auto_buffer, std::string> uncompress(const std::string& src,
if (err == Z_STREAM_END) {
done = true;
} else if (err != Z_OK) {
inflateEnd(&strm);
return Err(fmt::format("unable to uncompress: {} -- {}",
src, strm.msg ? strm.msg : zError(err)));
}