fix memory leak in decoding thread