Skip to content

Commit

Permalink
remove unneccessary null pointer check before delete
Browse files Browse the repository at this point in the history
  • Loading branch information
baotiao committed May 17, 2016
1 parent f83b0d0 commit e43f411
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/pika_binlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,7 @@ Status Binlog::SetProducerStatus(uint32_t pro_num, uint64_t pro_offset) {
pro_offset = 0;
}

if (queue_ != NULL) {
delete queue_;
}
delete queue_;

std::string init_profile = NewFileName(filename, 0);
if (slash::FileExists(init_profile)) {
Expand Down
4 changes: 1 addition & 3 deletions src/pika_binlog_sender_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ PikaBinlogSenderThread::~PikaBinlogSenderThread() {

pthread_join(thread_id(), NULL);

if (queue_ != NULL) {
delete queue_;
}
delete queue_;
pthread_rwlock_destroy(&rwlock_);
delete [] backing_store_;
delete cli_;
Expand Down
8 changes: 2 additions & 6 deletions src/pika_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ PikaServer::PikaServer() :
}

PikaServer::~PikaServer() {
if (bgsave_engine_ != NULL) {
delete bgsave_engine_;
}
delete bgsave_engine_;

// DispatchThread will use queue of worker thread,
// so we need to delete dispatch before worker.
Expand Down Expand Up @@ -585,9 +583,7 @@ bool PikaServer::InitBgsaveEnv() {

// Prepare bgsave env, need bgsave_protector protect
bool PikaServer::InitBgsaveEngine() {
if (bgsave_engine_ != NULL) {
delete bgsave_engine_;
}
delete bgsave_engine_;
nemo::Status nemo_s = nemo::BackupEngine::Open(
nemo::BackupableOptions(bgsave_info_.tmp_path, true, false),
&bgsave_engine_);
Expand Down

0 comments on commit e43f411

Please sign in to comment.