Skip to content

Commit

Permalink
FIX: the binlog bg worker may core when the command was not found (Op…
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hulk authored and Axlgrep committed Aug 28, 2018
1 parent 379e193 commit c051885
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions include/pika_binlog_bgworker.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class BinlogBGWorker {
bool _readonly, BinlogBGWorker* _my)
: argv(_argv), binlog_item(_binlog_item), serial(_s), readonly(_readonly), myself(_my) {
}
~BinlogBGArg() {
delete argv;
delete binlog_item;
}
};

};
Expand Down
6 changes: 4 additions & 2 deletions src/pika_binlog_bgworker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ void BinlogBGWorker::DoBinlogBG(void* arg) {
Cmd* c_ptr = self->GetCmd(opt);
if (!cinfo_ptr || !c_ptr) {
LOG(WARNING) << "Error operation from binlog: " << opt;
delete bgarg;
return;
}
c_ptr->res().clear();

// Initial
c_ptr->Initial(argv, cinfo_ptr);
if (!c_ptr->res().ok()) {
LOG(WARNING) << "Fail to initial command from binlog: " << opt;
delete bgarg;
return;
}

uint64_t start_us = 0;
Expand Down Expand Up @@ -101,7 +105,5 @@ void BinlogBGWorker::DoBinlogBG(void* arg) {
}
}

delete bgarg->argv;
delete bgarg->binlog_item;
delete bgarg;
}

0 comments on commit c051885

Please sign in to comment.