Skip to content

Commit

Permalink
[Support] Don't initialize buffer allocated by zlib::uncompress
Browse files Browse the repository at this point in the history
This is a somewhat annoying API, but not without precedend in this low
level API.
  • Loading branch information
d0k committed May 3, 2020
1 parent 7c20316 commit 7a529ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Support/Compression.cpp
Expand Up @@ -74,10 +74,10 @@ Error zlib::uncompress(StringRef InputBuffer, char *UncompressedBuffer,
Error zlib::uncompress(StringRef InputBuffer,
SmallVectorImpl<char> &UncompressedBuffer,
size_t UncompressedSize) {
UncompressedBuffer.resize(UncompressedSize);
UncompressedBuffer.reserve(UncompressedSize);
Error E =
uncompress(InputBuffer, UncompressedBuffer.data(), UncompressedSize);
UncompressedBuffer.resize(UncompressedSize);
UncompressedBuffer.set_size(UncompressedSize);
return E;
}

Expand Down

0 comments on commit 7a529ad

Please sign in to comment.