mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-01 03:05:50 +00:00
Better to not pass tmp_socket to setsockopt if there was an error here creating the socket.
This commit is contained in:
parent
479a06bda6
commit
782480c48b
@ -1490,7 +1490,9 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma
|
|||||||
remote.sin_port = htons(4242);
|
remote.sin_port = htons(4242);
|
||||||
|
|
||||||
memset(&iface_out, 0, sizeof(iface_out));
|
memset(&iface_out, 0, sizeof(iface_out));
|
||||||
tmp_socket = socket(AF_INET, SOCK_DGRAM, 0);
|
if ( (tmp_socket = socket(AF_INET, SOCK_DGRAM, 0)) == -1 ) {
|
||||||
|
goto doh;
|
||||||
|
}
|
||||||
|
|
||||||
if (setsockopt(tmp_socket, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) == -1) {
|
if (setsockopt(tmp_socket, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) == -1) {
|
||||||
goto doh;
|
goto doh;
|
||||||
@ -1528,7 +1530,9 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma
|
|||||||
remote.sin6_port = htons(4242);
|
remote.sin6_port = htons(4242);
|
||||||
|
|
||||||
memset(&iface_out, 0, sizeof(iface_out));
|
memset(&iface_out, 0, sizeof(iface_out));
|
||||||
tmp_socket = socket(AF_INET6, SOCK_DGRAM, 0);
|
if ( (tmp_socket = socket(AF_INET6, SOCK_DGRAM, 0)) == -1 ) {
|
||||||
|
goto doh;
|
||||||
|
}
|
||||||
|
|
||||||
if (connect(tmp_socket, (struct sockaddr *) &remote, sizeof(remote)) == -1) {
|
if (connect(tmp_socket, (struct sockaddr *) &remote, sizeof(remote)) == -1) {
|
||||||
goto doh;
|
goto doh;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user