[Winpcap-users] pcap_freealldevs() causing program crash.

Eric Hansen nightskywriter at gmail.com
Wed Nov 16 17:01:34 GMT 2005


Yup :) I've debugged the pointer to, to make sure there wasn't something I
wasn't catching otherwise. I think I found my problem though. What if I do
not call pcap_open()? For example, if I don't call that, should I still be
calling freealldevs()?

On 11/16/05, Gianluca Varenni <gianluca.varenni at cacetech.com> wrote:
>
> Hi.
>  Did you also check that you aren't calling CDevice::Cleanup multiple
> times on the same "devs" pointer (thus trying to free the adapters list
> multiple times)?
>  Have a nice day
> GV
>
> ----- Original Message -----
> *From:* Eric Hansen <nightskywriter at gmail.com>
> *To:* WinPCap Mailing List <winpcap-users at winpcap.org>
> *Sent:* Sunday, November 13, 2005 4:04 PM
> *Subject:* [Winpcap-users] pcap_freealldevs() causing program crash.
>
> Does anyone know why, whenever I put in "pcap_freealldevs(devs);" into my
> cleanup code (that frees all the memory, etc...that my program uses), it
> always crashes?
>
> devs declaration:
> pcap_if_t *devs, *d; // Device list
>
> My cleanup code:
> void CDevice::Cleanup(){
>
> // Free the device list
> pcap_freealldevs(devs);
> }
>
> and how I'm using devs:
> void CDevice::Devices(){
> if(pcap_findalldevs(&devs, error) == -1){
> AfxMessageBox(error);
> } else{
> for(iCount = 0, d = devs; d != NULL; d = d->next, iCount++){
> if(d->description){
> cDescription[iCount] = d->description;
> }
>
> cDevice[iCount] = d->name;
> }
> }
> }
>
> I've been racking my brain for over an hour trying to figure out what I'm
> doing.
>
> (Note: I call Cleanup() in the WM_DESTROY Windows message)
>
> ------------------------------
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
>
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
>
>
>


--
http://tenshi.honeyblade.net (my poetry)

"You wanted this ending to happen...ROMANTISUTO!"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20051116/1fa70047/attachment-0001.htm


More information about the Winpcap-users mailing list