avoid double free if wait_for_event returns WAIT_FOR_EVENT_EXCEPTION