Skip to content

Commit

Permalink
bugfix: 1. fix the memory leak bugs in SScan and ZScan command; 2. mo…
Browse files Browse the repository at this point in the history
…dify info format(slave lists messsage)
  • Loading branch information
wuxiaofei-xy committed May 11, 2016
1 parent 95950d8 commit ba17d86
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/pika_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,12 @@ int32_t PikaServer::GetSlaveListString(std::string& slave_list_str) {
size_t index = 0, slaves_num = slaves_.size();

std::stringstream tmp_stream;
std::string slave_ip_port;
while (index < slaves_num) {
tmp_stream << "slave" << index << ": host_port=" << slaves_[index].ip_port
<< " state=" << (slaves_[index].stage == SLAVE_ITEM_STAGE_TWO ? "online" : "offline") << "\r\n";
slave_ip_port = slaves_[index].ip_port;
tmp_stream << "slave" << index << ":ip=" << slave_ip_port.substr(0, slave_ip_port.find(":"))
<< ",port=" << slave_ip_port.substr(slave_ip_port.find(":")+1)
<< ",state=" << (slaves_[index].stage == SLAVE_ITEM_STAGE_TWO ? "online" : "offline") << "\r\n";
index++;
}
slave_list_str.assign(tmp_stream.str());
Expand Down
1 change: 1 addition & 0 deletions src/pika_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ void SScanCmd::Do() {
res_.AppendStringLen(iter_member->size());
res_.AppendContent(*iter_member);
}
delete iter;
return;
}

Expand Down
1 change: 1 addition & 0 deletions src/pika_zset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ void ZScanCmd::Do() {
res_.AppendStringLen(len);
res_.AppendContent(buf);
}
delete iter;
return;
}

Expand Down
2 changes: 1 addition & 1 deletion third/nemo
Submodule nemo updated from 4884a5 to 78d0c6

0 comments on commit ba17d86

Please sign in to comment.