Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cluster_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ bool cluster_client::connect_shard_connection(shard_connection* sc, char* addres
memcpy(ci.addr_buf, addr_info->ai_addr, addr_info->ai_addrlen);
ci.ci_addr = (struct sockaddr *) ci.addr_buf;
ci.ci_addrlen = addr_info->ai_addrlen;
freeaddrinfo(addr_info);

// call connect
res = sc->connect(&ci);
Expand Down Expand Up @@ -240,7 +241,7 @@ void cluster_client::handle_cluster_slots(protocol_response *r) {

// port
bulk_el* mbulk_port_el = shard->mbulks_elements[2]->as_mbulk_size()->mbulks_elements[1]->as_bulk();
char* port = (char*) malloc(mbulk_port_el->value_len);
char* port = (char*) malloc(mbulk_port_el->value_len + 1);
memcpy(port, mbulk_port_el->value + 1, mbulk_port_el->value_len);
port[mbulk_port_el->value_len] = '\0';

Expand Down
2 changes: 1 addition & 1 deletion protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class redis_protocol : public abstract_protocol {
mbulk_size_el* m_current_mbulk;

public:
redis_protocol() : m_response_state(rs_initial), m_bulk_len(0), m_response_len(0) { }
redis_protocol() : m_response_state(rs_initial), m_bulk_len(0), m_response_len(0), m_total_bulks_count(0), m_current_mbulk(NULL) { }
virtual redis_protocol* clone(void) { return new redis_protocol(); }
virtual int select_db(int db);
virtual int authenticate(const char *credentials);
Expand Down