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
a633f8e1
Commit
a633f8e1
authored
Jul 31, 2018
by
shenlongxing
Committed by
antirez
Aug 02, 2018
Browse files
Fix cluster-announce-ip memory leak
parent
24c45538
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
a633f8e1
...
@@ -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