stream_wrap: fix memory leak on early return