Assert dictAdd success in pubsubRekeySubscriptionsForACLLoad

A failed insert would silently leak the pubsubUserSubs value and
drop provenance tracking, since the old dict's destructors are
disabled before release. Assert DICT_OK to catch duplicates early,
matching the style used in the subscribe path.
This commit is contained in:
Hristo Staykov 2026-05-26 19:04:13 +03:00
parent 3c680f96fc
commit 140d1b7099

View file

@ -981,11 +981,11 @@ void pubsubRekeySubscriptionsForACLLoad(client *c) {
if (pubsubUserIsNoAuth(old_user_ptr)) {
/* Sentinel key is a stable static pointer — carry it as-is. */
dictAdd(new_dict, old_user_ptr, subs);
serverAssert(dictAdd(new_dict, old_user_ptr, subs) == DICT_OK);
} else {
user *new_user = ACLGetUserByName(old_user_ptr->name, sdslen(old_user_ptr->name));
serverAssert(new_user != NULL);
dictAdd(new_dict, new_user, subs);
serverAssert(dictAdd(new_dict, new_user, subs) == DICT_OK);
}
}
dictResetIterator(&di);