[Winpcap-users] freeing memory allocated by pcap_stats_ex vie wpcap.dll

Gal Szkolnik cavemangsz at gmail.com
Mon Jun 6 10:08:46 GMT 2005


Hello.
I've been using WinPCap for a long time now with a C# application we 
constructed over here (= my work place), and am very pleased with it.

I have one problem which I can't fix gracefully, and was wondering if anyone 
can help me.

As I understand from the code, pcap_stats_ex allocates the memory for the 
user, and later the user is responsible to deallocate it.
My problem is that I am accesing wpcap.dll through PInvoke and don't have 
access to the memory managment functions used in the pcap dll.

Another issue, is if used from another exe or dll (this time unmanaged 
regular C++ or C) if the compiler/libraries are different from what 
winpcap.dll was built with they would not be compatible when freeing memory. 


I would suggest a solution: Use a free_stats function in wpcap.lib which 
frees the allocated buffer. The user still deallocates the structure, but 
does it via a function call to the dll. This ensures deallocation is done 
correctly. 

Tell me what you think? and if you'll change the source code and add this 
function

-- 
Truly Yours
Gal Szkolnik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20050606/f9ab7cee/attachment.html


More information about the Winpcap-users mailing list