Skip to content
  • Philip Withnall's avatar
    agent: Clear existing GSource timeouts before adding new ones · 5ed865fb
    Philip Withnall authored
    Modify agent_timeout_add_with_context() to force destroying and freeing
    of an existing GSource before overwriting it with a new one (probably
    with an updated timeout period).
    
    This fixes a case in priv_map_reply_to_relay_refresh() where the TURN
    candidate refresh timer was being overwritten with a new one, without
    the old one being destroyed. This lead to two timeouts existing, only
    one of which would be destroyed when the CandidateRefresh struct was
    freed, leaking the other one (in the main context) and allowing it to be
    later dispatched with a dangling CandidateRefresh pointer.
    
    The modification to agent_timeout_add_with_context() should prevent this
    happening in new code in future.
    5ed865fb