diff --git a/libretro-common/net/net_natt.c b/libretro-common/net/net_natt.c index 92fdaeca77..a94ca9b908 100644 --- a/libretro-common/net/net_natt.c +++ b/libretro-common/net/net_natt.c @@ -99,11 +99,12 @@ static bool natt_open_port(struct natt_status *status, { #ifndef HAVE_SOCKET_LEGACY #if HAVE_MINIUPNPC + int r; char host[PATH_MAX_LENGTH], ext_host[PATH_MAX_LENGTH], port_str[6], ext_port_str[6]; - const char *proto_str; - struct addrinfo hints = {0}, *ext_addrinfo; - int r; + struct addrinfo hints = {0}; + const char *proto_str = NULL; + struct addrinfo *ext_addrinfo = NULL; /* if NAT traversal is uninitialized or unavailable, oh well */ if (!urls.controlURL || !urls.controlURL[0]) @@ -156,6 +157,7 @@ static bool natt_open_port(struct natt_status *status, return false; } + freeaddrinfo_retro(ext_addrinfo); return true; #else