tcpdump mailing list archives

Re: libpcap: Memory-loeaks SIGSEGV


From: Guy Harris <guy () alum mit edu>
Date: Fri, 10 Aug 2007 22:07:05 -0700

TJ wrote:

I'm not sure if these leaks and losses are related to the SIGSEGV but
they certainly ought to be cleared up.

Yes, they should, and here's how you do it:

In your program, replace

        pcap_if_t *this_dev;
        pcap_if_t **alldevsp = &this_dev;

with

        pcap_if_t *alldevs, *this_dev;

replace

        if (pcap_findalldevs(alldevsp, errbuf) == 0) {

with

        if (pcap_findalldevs(&alldevs, errbuf) == 0) {

replace

        this_dev = *alldevsp;

with

        this_dev = alldevs;

and replace

        pcap_freealldevs(*alldevsp); // free list memory

with

        pcap_freealldevs(alldevs); // free list memory

which will fix the bug in your program that causes the leaks.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: