From dd56fac75b232e189afeff3c1cb3fc92e1ca8461 Mon Sep 17 00:00:00 2001 From: vnt-dev <49143209+vnt-dev@users.noreply.github.com> Date: Mon, 16 Dec 2024 20:19:54 +0800 Subject: [PATCH] call WintunReleaseReceivePacket (#11) --- src/session.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/session.rs b/src/session.rs index f17c0b7..6fa36dc 100644 --- a/src/session.rs +++ b/src/session.rs @@ -173,10 +173,12 @@ impl Session { } let size = size as usize; if size > buf.len() { + unsafe { wintun.WintunReleaseReceivePacket(self.inner.0, ptr) }; use std::io::{Error, ErrorKind::InvalidInput}; return Err(Error::new(InvalidInput, "destination buffer too small")); } unsafe { ptr::copy_nonoverlapping(ptr, buf.as_mut_ptr(), size) }; + unsafe { wintun.WintunReleaseReceivePacket(self.inner.0, ptr) }; Ok(size) }