From a1c5e45db3549276072033423ae786e91bfacde6 Mon Sep 17 00:00:00 2001 From: "eissajamil@gmail.com" Date: Sun, 29 Mar 2015 15:57:19 -0500 Subject: [PATCH 1/2] Removal of null check Removed the redundant check for NULL which is already correctly handled by used the delete --- src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc index 13ed0b64b..08fec77b4 100644 --- a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc @@ -107,7 +107,7 @@ class MockGeneratorContext : public GeneratorContext { virtual io::ZeroCopyOutputStream* Open(const string& filename) { string** map_slot = &files_[filename]; - if (*map_slot != NULL) delete *map_slot; + delete *map_slot; *map_slot = new string; return new io::StringOutputStream(*map_slot); From 914605c4dcf7b920ddeb4f66dc0229fa9ac4e709 Mon Sep 17 00:00:00 2001 From: "eissajamil@gmail.com" Date: Sun, 29 Mar 2015 15:59:34 -0500 Subject: [PATCH 2/2] Removal of null check Removed the redundant check for NULL which is already handled by using delete --- src/google/protobuf/io/gzip_stream.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/google/protobuf/io/gzip_stream.cc b/src/google/protobuf/io/gzip_stream.cc index c9f4ca7fa..77d485cf3 100644 --- a/src/google/protobuf/io/gzip_stream.cc +++ b/src/google/protobuf/io/gzip_stream.cc @@ -241,9 +241,7 @@ void GzipOutputStream::Init(ZeroCopyOutputStream* sub_stream, GzipOutputStream::~GzipOutputStream() { Close(); - if (input_buffer_ != NULL) { - operator delete(input_buffer_); - } + operator delete(input_buffer_); } // private