Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

modified the BRPOPLPUSH target field cleanup strategy to fix it the p…

…roper way.
  • Loading branch information...
commit 0d119ad3a3a7973a31a64ebdae0c6bb074529626 1 parent 6a1275b
@antirez antirez authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/t_list.c
View
8 src/t_list.c
@@ -870,6 +870,9 @@ int handleClientsWaitingListPush(redisClient *c, robj *key, robj *ele) {
receiver = ln->value;
dstkey = receiver->bpop.target;
+ /* Protect receiver->bpop.target, that will be freed by
+ * the next unblockClientWaitingData() call. */
+ if (dstkey) incrRefCount(dstkey);
/* This should remove the first element of the "clients" list. */
unblockClientWaitingData(receiver);
@@ -882,13 +885,12 @@ int handleClientsWaitingListPush(redisClient *c, robj *key, robj *ele) {
} else {
/* BRPOPLPUSH, note that receiver->db is always equal to c->db. */
dstobj = lookupKeyWrite(receiver->db,dstkey);
- if (dstobj && checkType(receiver,dstobj,REDIS_LIST)) {
- decrRefCount(dstkey);
- } else {
+ if (!(dstobj && checkType(receiver,dstobj,REDIS_LIST))) {
rpoplpushHandlePush(c,receiver,dstkey,dstobj,ele);
decrRefCount(dstkey);
return 1;
}
+ decrRefCount(dstkey);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.