fix memory leak in windows ptr_lookup

This commit is contained in:
Christien Rioux 2024-06-29 18:19:27 +00:00
parent 0b0d9b5291
commit fcf032e13e

View File

@ -169,6 +169,7 @@ pub async fn ptr_lookup(ip_addr: IpAddr) -> EyreResult<String> {
let c_str: &CStr = CStr::from_ptr(p_name_host.0 as *const i8); let c_str: &CStr = CStr::from_ptr(p_name_host.0 as *const i8);
if let Ok(str_slice) = c_str.to_str() { if let Ok(str_slice) = c_str.to_str() {
let str_buf: String = str_slice.to_owned(); let str_buf: String = str_slice.to_owned();
DnsFree(Some(p_query_results as *const c_void), DnsFreeRecordList);
return Ok(str_buf); return Ok(str_buf);
} }
} }