Fix potential memory leak

This commit is contained in:
Pierre HUBERT 2022-12-07 11:16:42 +01:00
parent 75d69de86c
commit 576188da12

View File

@ -97,7 +97,7 @@ async fn index() -> HttpResponse {
)
}
struct SendWrapper(mpsc::Sender<Vec<u8>>);
struct SendWrapper(mpsc::SyncSender<Vec<u8>>);
impl Write for SendWrapper {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
@ -122,7 +122,7 @@ struct FileStreamer {
impl FileStreamer {
pub fn start() -> Self {
let (send, receive) = mpsc::channel();
let (send, receive) = mpsc::sync_channel(1);
std::thread::spawn(move || {
let mut tar = tar::Builder::new(SendWrapper(send));