mirror of
https://github.com/fluencelabs/redis
synced 2025-03-31 14:51:04 +00:00
Merge pull request #3239 from dvirsky/fix_hashset_crash
fixed bad transfer of ownership in HashSet causing a potential crash
This commit is contained in:
commit
01a83d0a2a
11
src/module.c
11
src/module.c
@ -1795,10 +1795,13 @@ int RM_HashSet(RedisModuleKey *key, int flags, ...) {
|
|||||||
if (flags & REDISMODULE_HASH_CFIELDS)
|
if (flags & REDISMODULE_HASH_CFIELDS)
|
||||||
low_flags |= HASH_SET_TAKE_FIELD;
|
low_flags |= HASH_SET_TAKE_FIELD;
|
||||||
updated += hashTypeSet(key->value, field->ptr, value->ptr, low_flags);
|
updated += hashTypeSet(key->value, field->ptr, value->ptr, low_flags);
|
||||||
field->ptr = NULL; /* Ownership is now of hashTypeSet() */
|
|
||||||
|
/* If CFIELDS is active, ownership is now of hashTypeSet() */
|
||||||
/* Cleanup */
|
if (flags & REDISMODULE_HASH_CFIELDS) {
|
||||||
if (flags & REDISMODULE_HASH_CFIELDS) decrRefCount(field);
|
field->ptr = NULL;
|
||||||
|
/* Cleanup */
|
||||||
|
decrRefCount(field);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
moduleDelKeyIfEmpty(key);
|
moduleDelKeyIfEmpty(key);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user