mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-27 06:11:51 +00:00
Use net_ifinfo how it's intended (?) to be used
This commit is contained in:
parent
c342c103ae
commit
025993231f
@ -156,7 +156,7 @@ bool natt_open_port(struct natt_status *status, struct sockaddr *addr, socklen_t
|
||||
|
||||
bool natt_open_port_any(struct natt_status *status, uint16_t port, enum socket_protocol proto)
|
||||
{
|
||||
struct net_ifinfo list;
|
||||
struct net_ifinfo *list;
|
||||
bool ret = false;
|
||||
size_t i;
|
||||
struct addrinfo hints = {0}, *addr;
|
||||
@ -165,13 +165,15 @@ bool natt_open_port_any(struct natt_status *status, uint16_t port, enum socket_p
|
||||
sprintf(port_str, "%hu", port);
|
||||
|
||||
/* get our interfaces */
|
||||
if (!net_ifinfo_new(&list))
|
||||
if ((list = calloc(1, sizeof(struct net_ifinfo))) == NULL)
|
||||
return false;
|
||||
if (!net_ifinfo_new(list))
|
||||
return false;
|
||||
|
||||
/* loop through them */
|
||||
for (i = 0; i < list.size; i++)
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
struct net_ifinfo_entry *entry = list.entries + i;
|
||||
struct net_ifinfo_entry *entry = list->entries + i;
|
||||
|
||||
/* ignore localhost */
|
||||
if (!strcmp(entry->host, "127.0.0.1") || !strcmp(entry->host, "::1"))
|
||||
@ -185,7 +187,8 @@ bool natt_open_port_any(struct natt_status *status, uint16_t port, enum socket_p
|
||||
}
|
||||
}
|
||||
|
||||
/* BUGS! net_ifinfo_free(&list); */
|
||||
/* This really shouldn't free list, but does */
|
||||
net_ifinfo_free(list);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user