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

Eric Hansen nightskywriter at gmail.com
Mon Nov 14 00:04:51 GMT 2005


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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20051113/0e62897f/attachment.htm


More information about the Winpcap-users mailing list