From 3ccd66d54623985fc13b7fe47b457c364a07e069 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 20 Mar 2012 11:16:00 -0700 Subject: [PATCH] Cleanup potential fault in eth_close if eth_close is called with a NULL argument. --- sim_ether.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sim_ether.c b/sim_ether.c index 78cf7fc4..0b4dcfec 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -1713,12 +1713,13 @@ t_stat eth_close(ETH_DEV* dev) { char* msg = "Eth: closed %s\r\n"; pcap_t *pcap; -int pcap_fd = dev->fd_handle; +int pcap_fd; /* make sure device exists */ if (!dev) return SCPE_UNATT; /* close the device */ +pcap_fd = dev->fd_handle; /* save handle to possibly close later */ pcap = (pcap_t *)dev->handle; dev->handle = NULL; dev->fd_handle = 0;