Use unsafe blocks in ifaddrs.h implementation

This commit is contained in:
sourceturner
2026-01-16 22:01:00 +01:00
committed by sourceturner
parent d539b134ef
commit 12807920b6
+5 -2
View File
@@ -1,5 +1,8 @@
//! `ifaddrs.h` implementation
// TODO: set this for entire crate when possible
#![deny(unsafe_op_in_unsafe_fn)]
use core::ptr;
use crate::{
@@ -27,8 +30,8 @@ pub struct ifaddrs {
#[unsafe(no_mangle)]
pub unsafe extern "C" fn freeifaddrs(mut ifa: *mut ifaddrs) {
while !ifa.is_null() {
let next = (*ifa).ifa_next;
stdlib::free(ifa.cast());
let next = unsafe { (*ifa).ifa_next };
unsafe { stdlib::free(ifa.cast()) };
ifa = next;
}
}