From 1d7903eb5103cdcabdafdbad4c14883a27d818b1 Mon Sep 17 00:00:00 2001 From: Tore Fuglestad Date: Mon, 1 Jul 2024 14:08:50 +0200 Subject: [PATCH] fix windows warning avoid : error C4703: potentially uninitialized local pointer variable 'prev_adapter' used --- oshw/win32/oshw.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/oshw/win32/oshw.c b/oshw/win32/oshw.c index c217baa9..9756cc05 100644 --- a/oshw/win32/oshw.c +++ b/oshw/win32/oshw.c @@ -34,12 +34,11 @@ uint16 oshw_ntohs (uint16 network) */ ec_adaptert * oshw_find_adapters (void) { - int i = 0; int ret = 0; pcap_if_t *alldevs; pcap_if_t *d; ec_adaptert * adapter; - ec_adaptert * prev_adapter; + ec_adaptert * prev_adapter = NULL; ec_adaptert * ret_adapter = NULL; char errbuf[PCAP_ERRBUF_SIZE]; @@ -59,7 +58,7 @@ ec_adaptert * oshw_find_adapters (void) * adapter. * Else save as pointer to return. */ - if (i) + if (prev_adapter) { prev_adapter->next = adapter; } @@ -89,7 +88,6 @@ ec_adaptert * oshw_find_adapters (void) adapter->desc[0] = '\0'; } prev_adapter = adapter; - i++; } /* free all devices allocated */ pcap_freealldevs(alldevs);