[Winpcap-users] Problem Freeing Array Returned by pcap_list_datalinks

Yaser Zhian yzt at gmx.net
Sun Sep 10 08:08:24 GMT 2006


Guy Harris wrote:
> Yaser Zhian wrote:
> 
>> The following code also generates the same failure:
>>
>>  int * dltlist = 0;
>>  int r = pcap_list_datalinks (m_capturehnd, &dltlist);
>>  free (dltlist);
>>
>> The problem occurs in the free() call. Am I doing something wrong?
> 
> No.
> 
> That code should work.  If it doesn't work, it's either
> 
>     1) a bug in WinPcap;
> 
>     2) a bug in the C runtime;
> 
>     3) possibly a result of WinPcap being built for a different version
> of the C runtime than your application (so that the version of malloc()
> called by pcap_list_datalinks() doesn't match the version of free()
> called by your application), but I'm not an expert in the MSVC++ C
> runtime so I don't know whether that could or would be the case (UN*X C
> runtimes tend not to come in as many flavors and tend not to have that
> particular problem).
> 

Thanks for the quick reply.

I guess the 3rd scenario is more likely than the first two. And I
guess I'd have to build WinPcap from source, don't I?

(Interestingly, MSVC 8.0 doesn't seem to have a single-threaded
version of the CRT for me to test against that!)

-yzt

-- 
"Programming is an art that fights back!"


More information about the Winpcap-users mailing list