Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
35ca6700
Commit
35ca6700
authored
Jul 31, 2018
by
shenlongxing
Browse files
Fix cluster-announce-ip memory leak
parent
fd174cca
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
35ca6700
...
@@ -3325,10 +3325,11 @@ void clusterCron(void) {
...
@@ -3325,10 +3325,11 @@ void clusterCron(void) {
if (prev_ip && curr_ip && strcmp(prev_ip,curr_ip)) changed = 1;
if (prev_ip && curr_ip && strcmp(prev_ip,curr_ip)) changed = 1;
if (changed) {
if (changed) {
prev_ip = curr_ip;
if (prev_ip) zfree(prev_ip);
if (prev_ip) prev_ip = zstrdup(prev_ip);
prev_ip = curr_ip;
if (curr_ip) {
if (curr_ip) {
prev_ip = zstrdup(prev_ip);
strncpy(myself->ip,server.cluster_announce_ip,NET_IP_STR_LEN);
strncpy(myself->ip,server.cluster_announce_ip,NET_IP_STR_LEN);
myself->ip[NET_IP_STR_LEN-1] = '\0';
myself->ip[NET_IP_STR_LEN-1] = '\0';
} else {
} else {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment