Merge pull request #5724 from fr500/master

Fix leaks
This commit is contained in:
Twinaphex 2017-11-19 21:25:36 +01:00 committed by GitHub
commit 4c3969976b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,6 +237,11 @@ bool netplay_lan_ad_server(netplay_t *netplay)
char reply_addr[NETPLAY_HOST_STR_LEN], port_str[6];
struct addrinfo *our_addr, hints = {0};
net_ifinfo_t interfaces;
if (!net_ifinfo_new(&interfaces))
return false;
if (lan_ad_server_fd < 0 && !init_lan_ad_server_socket(netplay, RARCH_DEFAULT_PORT))
return false;
@ -277,11 +282,6 @@ bool netplay_lan_ad_server(netplay_t *netplay)
strlcpy(reply_addr, ad_packet_buffer.address, NETPLAY_HOST_STR_LEN);
net_ifinfo_t interfaces;
if (!net_ifinfo_new(&interfaces))
return false;
for (k = 0; k < interfaces.size; k++)
{
char *p;
@ -339,6 +339,8 @@ bool netplay_lan_ad_server(netplay_t *netplay)
/* And send it */
sendto(lan_ad_server_fd, (const char*)&ad_packet_buffer,
sizeof(struct ad_packet), 0, our_addr->ai_addr, our_addr->ai_addrlen);
if (our_addr)
freeaddrinfo_retro(our_addr);
}
else
continue;
@ -347,8 +349,9 @@ bool netplay_lan_ad_server(netplay_t *netplay)
continue;
}
}
}
net_ifinfo_free(&interfaces);
return true;
}