diff options
author | yongman <yming0221@gmail.com> | 2019-04-09 09:24:22 +0800 |
---|---|---|
committer | yongman <yming0221@gmail.com> | 2019-04-09 09:24:22 +0800 |
commit | d490752d58ecd0a815bdbbb350b550919fcc7a4a (patch) | |
tree | 71b6378d51bd6d2c18d392f6c6cbad495149d3fe | |
parent | c24e32041b91ac32626e8d8eee1c062942e25f27 (diff) | |
download | redis-d490752d58ecd0a815bdbbb350b550919fcc7a4a.tar.gz |
Fix memleak in bitfieldCommand
-rw-r--r-- | src/bitops.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bitops.c b/src/bitops.c index 8d03a7699..ee1ce0460 100644 --- a/src/bitops.c +++ b/src/bitops.c @@ -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); |