fix mContentLength bug and memory leak