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
c8a10631
Commit
c8a10631
authored
Jul 22, 2010
by
Pieter Noordhuis
Browse files
fix rare condition where 'key' would already be destroyed while is was needed later on
parent
2f996f02
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/vm.c
View file @
c8a10631
...
@@ -1075,6 +1075,11 @@ int dontWaitForSwappedKey(redisClient *c, robj *key) {
...
@@ -1075,6 +1075,11 @@ int dontWaitForSwappedKey(redisClient *c, robj *key) {
listIter
li
;
listIter
li
;
struct
dictEntry
*
de
;
struct
dictEntry
*
de
;
/* The key object might be destroyed when deleted from the c->io_keys
* list (and the "key" argument is physically the same object as the
* object inside the list), so we need to protect it. */
incrRefCount
(
key
);
/* Remove the key from the list of keys this client is waiting for. */
/* Remove the key from the list of keys this client is waiting for. */
listRewind
(
c
->
io_keys
,
&
li
);
listRewind
(
c
->
io_keys
,
&
li
);
while
((
ln
=
listNext
(
&
li
))
!=
NULL
)
{
while
((
ln
=
listNext
(
&
li
))
!=
NULL
)
{
...
@@ -1095,6 +1100,7 @@ int dontWaitForSwappedKey(redisClient *c, robj *key) {
...
@@ -1095,6 +1100,7 @@ int dontWaitForSwappedKey(redisClient *c, robj *key) {
if
(
listLength
(
l
)
==
0
)
if
(
listLength
(
l
)
==
0
)
dictDelete
(
c
->
db
->
io_keys
,
key
);
dictDelete
(
c
->
db
->
io_keys
,
key
);
decrRefCount
(
key
);
return
listLength
(
c
->
io_keys
)
==
0
;
return
listLength
(
c
->
io_keys
)
==
0
;
}
}
...
...
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