summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2019-04-26 17:31:42 +0200
committerGitHub <noreply@github.com>2019-04-26 17:31:42 +0200
commit5ba908fa5ff43f092e28d425230cdbfc2796421a (patch)
tree0e79a2581396c86b75f7fedc8653ea8d5188325e
parent5c5197fe4f40ad697d5350529989f38122327bd1 (diff)
parentd490752d58ecd0a815bdbbb350b550919fcc7a4a (diff)
downloadredis-5ba908fa5ff43f092e28d425230cdbfc2796421a.tar.gz
Merge pull request #6002 from yongman/fix-memleak-in-bitfield
Fix memleak in bitfieldCommand
-rw-r--r--src/bitops.c10
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);