Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
5b3d73b3
Commit
5b3d73b3
authored
Feb 28, 2018
by
Artix
Committed by
artix
Apr 23, 2018
Browse files
Cluster Manager: fixed some memory error
parent
220375b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
5b3d73b3
...
@@ -2412,14 +2412,19 @@ static int clusterManagerSetSlot(clusterManagerNode *node1,
...
@@ -2412,14 +2412,19 @@ static int clusterManagerSetSlot(clusterManagerNode *node1,
(char *) node2->name);
(char *) node2->name);
if (err != NULL) *err = NULL;
if (err != NULL) *err = NULL;
if (!reply) return 0;
if (!reply) return 0;
int success = 1;
if (reply->type == REDIS_REPLY_ERROR) {
if (reply->type == REDIS_REPLY_ERROR) {
success = 0;
if (err != NULL) {
if (err != NULL) {
*err = zmalloc((reply->len + 1) * sizeof(char));
*err = zmalloc((reply->len + 1) * sizeof(char));
strcpy(*err, reply->str);
strcpy(*err, reply->str);
CLUSTER_MANAGER_PRINT_REPLY_ERROR(node1, err);
}
}
return 0
;
goto cleanup
;
}
}
return 1;
cleanup:
freeReplyObject(reply);
return success;
}
}
static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
...
@@ -3175,7 +3180,7 @@ static list *clusterManagerComputeReshardTable(list *sources, int numslots) {
...
@@ -3175,7 +3180,7 @@ static list *clusterManagerComputeReshardTable(list *sources, int numslots) {
int slot = node->slots[j];
int slot = node->slots[j];
if (!slot) continue;
if (!slot) continue;
if (count >= max || (int)listLength(moved) >= numslots) break;
if (count >= max || (int)listLength(moved) >= numslots) break;
clusterManagerReshardTableItem *item = zmalloc(sizeof(item));
clusterManagerReshardTableItem *item = zmalloc(sizeof(
*
item));
item->source = node;
item->source = node;
item->slot = j;
item->slot = j;
listAddNodeTail(moved, item);
listAddNodeTail(moved, item);
...
...
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