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

Gianluca Varenni gianluca.varenni at cacetech.com
Wed Nov 16 15:55:46 GMT 2005


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 
  To: WinPCap Mailing List 
  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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20051116/8c752ded/attachment.htm


More information about the Winpcap-users mailing list