25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Avoid orphan_item leak on affiliation/subscription removal (#1563)

This commit is contained in:
Christophe Romain 2017-02-23 16:43:22 +01:00
parent bc9f178b6d
commit 720741b725

View File

@ -707,7 +707,13 @@ del_state(#pubsub_state{stateid = {Key, Nidx}, items = Items}) ->
[] ->
ok;
_ ->
Orphan = #pubsub_orphan{nodeid = Nidx, items = Items},
Orphan = #pubsub_orphan{nodeid = Nidx, items =
case mnesia:read({pubsub_orphan, Nidx}) of
[#pubsub_orphan{items = ItemIds}] ->
lists:usort(ItemIds++Items);
_ ->
Items
end},
mnesia:write(Orphan)
end,
mnesia:delete({pubsub_state, {Key, Nidx}}).