Merge pull request #4431 from itamarhaber/patch-10

Fixes an off-by-one in argument handling of `MEMORY USAGE`
This commit is contained in:
Salvatore Sanfilippo 2017-11-08 15:42:45 +01:00 committed by GitHub
commit 30db805548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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) {