From 71dac45765e9bbb9a2851ee3b1eaecfac6e7a8fd Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 21 Sep 2009 10:45:09 -0700 Subject: If an activate routine fails, it needs to clean up the pcap_t, close anything it's opened, etc.. In addition, the op pointers need to be restored to the un-activated state; do that in pcap_activate() if the call to the activate op fails. Also, in the common cleanup code, set the fd's to -1. --- pcap-usb-linux.c | 1 + 1 file changed, 1 insertion(+) (limited to 'pcap-usb-linux.c') diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index ba18277..bcbe45a 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -384,6 +384,7 @@ usb_activate(pcap_t* handle) if (!handle->buffer) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "malloc: %s", pcap_strerror(errno)); + close(handle->fd); return PCAP_ERROR; } return 0; -- cgit v1.2.3