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 73c5902548

View File

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