Skip to content

Commit 1d7903e

Browse files
committed
fix windows warning
avoid : error C4703: potentially uninitialized local pointer variable 'prev_adapter' used
1 parent 83c6264 commit 1d7903e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

oshw/win32/oshw.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ uint16 oshw_ntohs (uint16 network)
3434
*/
3535
ec_adaptert * oshw_find_adapters (void)
3636
{
37-
int i = 0;
3837
int ret = 0;
3938
pcap_if_t *alldevs;
4039
pcap_if_t *d;
4140
ec_adaptert * adapter;
42-
ec_adaptert * prev_adapter;
41+
ec_adaptert * prev_adapter = NULL;
4342
ec_adaptert * ret_adapter = NULL;
4443
char errbuf[PCAP_ERRBUF_SIZE];
4544

@@ -59,7 +58,7 @@ ec_adaptert * oshw_find_adapters (void)
5958
* adapter.
6059
* Else save as pointer to return.
6160
*/
62-
if (i)
61+
if (prev_adapter)
6362
{
6463
prev_adapter->next = adapter;
6564
}
@@ -89,7 +88,6 @@ ec_adaptert * oshw_find_adapters (void)
8988
adapter->desc[0] = '\0';
9089
}
9190
prev_adapter = adapter;
92-
i++;
9391
}
9492
/* free all devices allocated */
9593
pcap_freealldevs(alldevs);

0 commit comments

Comments
 (0)