Fixes an off-by-one in argument handling of MEMORY USAGE

Fixes #4430
This commit is contained in:
Itamar Haber 2017-11-08 16:08:29 +02:00 committed by antirez
parent 897d857115
commit f31d9b12fd

View File

@ -1074,7 +1074,7 @@ void memoryCommand(client *c) {
if ((o = objectCommandLookupOrReply(c,c->argv[2],shared.nullbulk))
== NULL) return;
size_t usage = objectComputeSize(o,samples);
usage += sdsAllocSize(c->argv[1]->ptr);
usage += sdsAllocSize(c->argv[2]->ptr);
usage += sizeof(dictEntry);
addReplyLongLong(c,usage);
} else if (!strcasecmp(c->argv[1]->ptr,"stats") && c->argc == 2) {