Fix routing thread memory leak