From e788e527d3d16db4059f92291c7806fe273c8f67 Mon Sep 17 00:00:00 2001 From: ckennelly Date: Thu, 26 May 2016 14:51:33 -0700 Subject: [PATCH] Avoid calling memset when resizing the buffer. This buffer will be initialized and then trimmed down to size during the compression phase. --- snappy.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snappy.cc b/snappy.cc index 8a3668c..957d82f 100644 --- a/snappy.cc +++ b/snappy.cc @@ -1151,7 +1151,7 @@ void RawCompress(const char* input, size_t Compress(const char* input, size_t input_length, string* compressed) { // Pre-grow the buffer to the max length of the compressed output - compressed->resize(MaxCompressedLength(input_length)); + STLStringResizeUninitialized(compressed, MaxCompressedLength(input_length)); size_t compressed_length; RawCompress(input, input_length, string_as_array(compressed),