tcpdump mailing list archives

Re: How to check if pcap_t is really free?


From: Nadav Vinik <nadavvin () gmail com>
Date: Thu, 20 Jun 2013 23:05:03 +0300

On 20 June 2013 22:47, Guy Harris <guy () alum mit edu> wrote:


On Jun 20, 2013, at 12:36 PM, Nadav Vinik <nadavvin () gmail com> wrote:

Hoever if I change to pcap_close(&handle) I get the following error:

Because code that passes a pointer to a pointer to a pcap_t, rather than a
pointer to a pcap_t, to pcap_close() is erroneous code.

You cannot arrange that libpcap somehow make a pcap_t or a pointer to it
detectably invalid when you close the handle; if you want to know whether a
pcap_t has been closed, you will have to make your code explicitly mark it
as such.  For example, replace all occurrences of

        pcap_close(handle);

in your code with

        pcap_close(handle);
        handle = NULL;


Back to the original question.

Is there a way to check if handle is already free?
my problem is that it become free even before it reach to pcap_close.

see:
https://mail.gnome.org/archives/vala-list/2013-June/msg00022.html

thanks
Nadav

-- 
הבלוג שלי:
http://nadavvin.com
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Current thread: