[Winpcap-users] Memory Management with pcap_next_ex()

Gianluca Varenni gianluca.varenni at cacetech.com
Tue Aug 19 20:11:00 GMT 2008

A packet returned by pcap_next_ex is valid until
- the next call to pcap_next_ex
- a call to pcap_close
(whatever comes first).

Packets returned by pcap_next_ex must not be freed. The library takes care 
of freeing such memory.

Documentation: I suggest you to have a look at slide #4 in this presentation


Have a nice day

----- Original Message ----- 
From: "Stanislav Tsanev" <skt304 at lehigh.edu>
To: <winpcap-users at winpcap.org>
Sent: Monday, August 18, 2008 7:09 PM
Subject: [Winpcap-users] Memory Management with pcap_next_ex()

>I am using pcap_next_ex() to read packets from a capture file. Who is 
>responsible for managing the memory that the two pointers I get back from 
>the function call point to? Is that memory reused as is the case when I use 
>a callback? If that's the case, how long is it guaranteed to persist? If 
>not, how do I free it?
> I was looking for documentation on that but couldn't find anything.
> thank,
> slavy
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users 

More information about the Winpcap-users mailing list