diff --git a/src/net/matching.c b/src/net/matching.c index 51db886a2..ad3fa8800 100644 --- a/src/net/matching.c +++ b/src/net/matching.c @@ -85,12 +85,11 @@ z_result_t _z_matching_listener_entity_undeclare(_z_session_t *zn, _z_zint_t ent _z_matching_listener_state_t *listener = _z_matching_listener_intmap_iterator_value(&iter); if (listener->entity_id == entity_id) { _Z_DEBUG("_z_matching_listener_entity_undeclare: entity=%i, listener=%i", (int)entity_id, (int)key); - _z_matching_listener_intmap_remove(&zn->_matching_listeners, key); - _Z_DEBUG("_z_matching_listener_entity_undeclare 1"); _z_remove_interest(zn, listener->interest_id); + _Z_DEBUG("_z_matching_listener_entity_undeclare 1"); + _z_matching_listener_intmap_remove(&zn->_matching_listeners, key); _Z_DEBUG("_z_matching_listener_entity_undeclare 2"); } - _z_str_intmap_iterator_next(&iter); } _Z_DEBUG("_z_matching_listener_entity_undeclare done"); return _Z_RES_OK;