mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Fixed a refcount stuff leading to PUBSUB crashes
This commit is contained in:
parent
de450ee9e5
commit
201037f562
3
redis.c
3
redis.c
@ -9301,6 +9301,8 @@ static int pubsubUnsubscribe(redisClient *c, robj *class, int notify) {
|
||||
int retval = 0;
|
||||
|
||||
/* Remove the class from the client -> classes hash table */
|
||||
incrRefCount(class); /* class may be just a pointer to the same object
|
||||
we have in the hash tables. Protect it... */
|
||||
if (dictDelete(c->pubsub_classes,class) == DICT_OK) {
|
||||
retval = 1;
|
||||
/* Remove the client from the class -> clients list hash table */
|
||||
@ -9318,6 +9320,7 @@ static int pubsubUnsubscribe(redisClient *c, robj *class, int notify) {
|
||||
addReplyBulk(c,class);
|
||||
addReplyLong(c,dictSize(c->pubsub_classes));
|
||||
}
|
||||
decrRefCount(class); /* it is finally safe to release it */
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user