mirror of https://github.com/fafhrd91/actix-web
fix double drop on error of getting file metadata
This commit is contained in:
parent
8c8746b732
commit
f8032adfd5
|
@ -195,9 +195,9 @@ impl NamedFile {
|
|||
// SAFETY: fd is borrowed and lives longer than the unsafe block.
|
||||
unsafe {
|
||||
let fs = std::fs::File::from_raw_fd(fd);
|
||||
let md = fs.metadata()?;
|
||||
let res = fs.metadata();
|
||||
std::mem::forget(fs);
|
||||
md
|
||||
res?
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -96,7 +96,7 @@ impl fmt::Debug for FilesService {
|
|||
impl Service<ServiceRequest> for FilesService {
|
||||
type Response = ServiceResponse;
|
||||
type Error = Error;
|
||||
type Future = LocalBoxFuture<'static, Result<ServiceResponse, Error>>;
|
||||
type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;
|
||||
|
||||
actix_service::always_ready!();
|
||||
|
||||
|
|
Loading…
Reference in New Issue