Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
cfaef8d5
Commit
cfaef8d5
authored
May 17, 2016
by
Dvir Volk
Browse files
fixed bad transfer of ownership in HashSet causing a potential crash
parent
9aff5640
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
cfaef8d5
...
@@ -1795,10 +1795,13 @@ int RM_HashSet(RedisModuleKey *key, int flags, ...) {
...
@@ -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);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment