From 7a529ad2c142eb77ff1140e166fb85242d4cf05f Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 3 May 2020 14:52:19 +0200 Subject: [PATCH] [Support] Don't initialize buffer allocated by zlib::uncompress This is a somewhat annoying API, but not without precedend in this low level API. --- llvm/lib/Support/Compression.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp index 97d5ffa..27d92f0 100644 --- a/llvm/lib/Support/Compression.cpp +++ b/llvm/lib/Support/Compression.cpp @@ -74,10 +74,10 @@ Error zlib::uncompress(StringRef InputBuffer, char *UncompressedBuffer, Error zlib::uncompress(StringRef InputBuffer, SmallVectorImpl &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; } -- 2.7.4