From a026dc2a4ee66630a237d84a4615829636a837cd Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Sat, 3 Aug 2024 13:53:10 +1000 Subject: [PATCH] Rm drop impl for LibraryHandle As unmounting dynlib might cause UB Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --- crates/detect-targets/src/detect/windows.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/detect-targets/src/detect/windows.rs b/crates/detect-targets/src/detect/windows.rs index 625d16e7..dbf38019 100644 --- a/crates/detect-targets/src/detect/windows.rs +++ b/crates/detect-targets/src/detect/windows.rs @@ -1,6 +1,6 @@ use std::{mem, ptr}; use windows_sys::Win32::{ - Foundation::{FreeLibrary, HMODULE, S_OK}, + Foundation::{HMODULE, S_OK}, System::{ LibraryLoader::{GetProcAddress, LoadLibraryA}, SystemInformation::{ @@ -33,12 +33,6 @@ impl LibraryHandle { } } -impl Drop for LibraryHandle { - fn drop(&mut self) { - unsafe { FreeLibrary(self.0) }; - } -} - type GetMachineTypeAttributesFuncType = unsafe extern "system" fn(u16, *mut MACHINE_ATTRIBUTES) -> i32; const _: () = {