Unverified Commit 2564963d authored by Itamar Haber's avatar Itamar Haber Committed by GitHub
Browse files

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

Fixes #4430
parent a1944c3e
...@@ -1074,7 +1074,7 @@ void memoryCommand(client *c) { ...@@ -1074,7 +1074,7 @@ void memoryCommand(client *c) {
if ((o = objectCommandLookupOrReply(c,c->argv[2],shared.nullbulk)) if ((o = objectCommandLookupOrReply(c,c->argv[2],shared.nullbulk))
== NULL) return; == NULL) return;
size_t usage = objectComputeSize(o,samples); size_t usage = objectComputeSize(o,samples);
usage += sdsAllocSize(c->argv[1]->ptr); usage += sdsAllocSize(c->argv[2]->ptr);
usage += sizeof(dictEntry); usage += sizeof(dictEntry);
addReplyLongLong(c,usage); addReplyLongLong(c,usage);
} else if (!strcasecmp(c->argv[1]->ptr,"stats") && c->argc == 2) { } else if (!strcasecmp(c->argv[1]->ptr,"stats") && c->argc == 2) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment