Merge pull request #6002 from yongman/fix-memleak-in-bitfield

Fix memleak in bitfieldCommand
This commit is contained in:
Salvatore Sanfilippo 2019-04-26 17:31:42 +02:00 committed by GitHub
commit 5ba908fa5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -994,12 +994,18 @@ void bitfieldCommand(client *c) {
/* Lookup for read is ok if key doesn't exit, but errors
* if it's not a string. */
o = lookupKeyRead(c->db,c->argv[1]);
if (o != NULL && checkType(c,o,OBJ_STRING)) return;
if (o != NULL && checkType(c,o,OBJ_STRING)) {
zfree(ops);
return;
}
} else {
/* Lookup by making room up to the farest bit reached by
* this operation. */
if ((o = lookupStringForBitCommand(c,
highest_write_offset)) == NULL) return;
highest_write_offset)) == NULL) {
zfree(ops);
return;
}
}
addReplyArrayLen(c,numops);