Is it expected that pcap_close(NULL)
segfaults? I'm observing this behaviour on libpcap-1.7.4-2ubuntu0.1
. The man
page does not say anything about behvaiour of the function for a NULL
pcap_t *
. I googled and could not find anything either.
The other answers are correct. And in general (not specific to pcap_close
), unless something is documented to accept a null pointer and treat it specially, the default assumption should always be that passing a null pointer is a violation of the interface contact, since a null pointer is not a valid pointer to whatever the function is documented to expect to receive a pointer to.