From b5929722363993bf0ad2a56d66176606cc742bc4 Mon Sep 17 00:00:00 2001 From: Oscar Deits Date: Sun, 27 Aug 2017 23:19:29 -0400 Subject: Remove unnecessary null pointer checks Fixes klee/klee#717 delete on null pointer is always safe. --- lib/Support/FileHandling.cpp | 3 +-- lib/Support/TreeStream.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/Support') diff --git a/lib/Support/FileHandling.cpp b/lib/Support/FileHandling.cpp index e5ead9f7..3e156f3c 100644 --- a/lib/Support/FileHandling.cpp +++ b/lib/Support/FileHandling.cpp @@ -31,8 +31,7 @@ llvm::raw_fd_ostream *klee_open_output_file(std::string &path, f = new llvm::raw_fd_ostream(path.c_str(), error, llvm::sys::fs::F_Binary); #endif if (!error.empty()) { - if (f) - delete f; + delete f; f = NULL; } return f; diff --git a/lib/Support/TreeStream.cpp b/lib/Support/TreeStream.cpp index a0e1596f..8681245b 100644 --- a/lib/Support/TreeStream.cpp +++ b/lib/Support/TreeStream.cpp @@ -40,8 +40,7 @@ TreeStreamWriter::TreeStreamWriter(const std::string &_path) TreeStreamWriter::~TreeStreamWriter() { flush(); - if (output) - delete output; + delete output; } bool TreeStreamWriter::good() { -- cgit 1.4.1