Merge commit 'dff5370c8be0dcef1728b95b17906d2494ce9bf2' into redis_6_merge

Former-commit-id: 8e33c2d30116ea469238c340ed367f0182856454
This commit is contained in:
John Sully 2020-04-14 18:05:10 -04:00
commit c198d81582
3 changed files with 20 additions and 6 deletions

View File

@ -1175,7 +1175,7 @@ int rioWriteBulkStreamID(rio *r,streamID *id) {
int retval; int retval;
sds replyid = sdscatfmt(sdsempty(),"%U-%U",id->ms,id->seq); sds replyid = sdscatfmt(sdsempty(),"%U-%U",id->ms,id->seq);
if ((retval = rioWriteBulkString(r,replyid,sdslen(replyid))) == 0) return 0; retval = rioWriteBulkString(r,replyid,sdslen(replyid));
sdsfree(replyid); sdsfree(replyid);
return retval; return retval;
} }

View File

@ -165,7 +165,10 @@ int clusterLoadConfig(char *filename) {
} }
/* Regular config lines have at least eight fields */ /* Regular config lines have at least eight fields */
if (argc < 8) goto fmterr; if (argc < 8) {
sdsfreesplitres(argv,argc);
goto fmterr;
}
/* Create this node if it does not exist */ /* Create this node if it does not exist */
n = clusterLookupNode(argv[0]); n = clusterLookupNode(argv[0]);
@ -174,7 +177,10 @@ int clusterLoadConfig(char *filename) {
clusterAddNode(n); clusterAddNode(n);
} }
/* Address and port */ /* Address and port */
if ((p = strrchr(argv[1],':')) == NULL) goto fmterr; if ((p = strrchr(argv[1],':')) == NULL) {
sdsfreesplitres(argv,argc);
goto fmterr;
}
*p = '\0'; *p = '\0';
memcpy(n->ip,argv[1],strlen(argv[1])+1); memcpy(n->ip,argv[1],strlen(argv[1])+1);
char *port = p+1; char *port = p+1;
@ -255,7 +261,10 @@ int clusterLoadConfig(char *filename) {
*p = '\0'; *p = '\0';
direction = p[1]; /* Either '>' or '<' */ direction = p[1]; /* Either '>' or '<' */
slot = atoi(argv[j]+1); slot = atoi(argv[j]+1);
if (slot < 0 || slot >= CLUSTER_SLOTS) goto fmterr; if (slot < 0 || slot >= CLUSTER_SLOTS) {
sdsfreesplitres(argv,argc);
goto fmterr;
}
p += 3; p += 3;
cn = clusterLookupNode(p); cn = clusterLookupNode(p);
if (!cn) { if (!cn) {
@ -275,8 +284,12 @@ int clusterLoadConfig(char *filename) {
} else { } else {
start = stop = atoi(argv[j]); start = stop = atoi(argv[j]);
} }
if (start < 0 || start >= CLUSTER_SLOTS) goto fmterr; if (start < 0 || start >= CLUSTER_SLOTS ||
if (stop < 0 || stop >= CLUSTER_SLOTS) goto fmterr; stop < 0 || stop >= CLUSTER_SLOTS)
{
sdsfreesplitres(argv,argc);
goto fmterr;
}
while(start <= stop) clusterAddSlot(n, start++); while(start <= stop) clusterAddSlot(n, start++);
} }

View File

@ -1548,6 +1548,7 @@ void pfdebugCommand(client *c) {
sds decoded = sdsempty(); sds decoded = sdsempty();
if (hdr->encoding != HLL_SPARSE) { if (hdr->encoding != HLL_SPARSE) {
sdsfree(decoded);
addReplyError(c,"HLL encoding is not sparse"); addReplyError(c,"HLL encoding is not sparse");
return; return;
} }