Fix VADD_CASReply() NULL reference on ID mismatch.

This bug was fixed thanks to the kind help of Dvir Dukhan
(@DvirDukhan) that found it and provided useful context.
This commit is contained in:
antirez 2025-03-18 21:37:06 +01:00
parent 99176b3e04
commit 70ffa8ce5c
1 changed files with 2 additions and 1 deletions

3
vset.c
View File

@ -340,7 +340,8 @@ int VADD_CASReply(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
* the other insert won. We don't even start a threaded VADD
* if this was an udpate, since the deletion of the element itself
* in order to perform the update would invalidate the CAS state. */
if (RedisModule_DictGet(vset->dict,val,NULL) != NULL) vset = NULL;
if (vset && RedisModule_DictGet(vset->dict,val,NULL) != NULL)
vset = NULL;
}
if (vset == NULL) {