Commit 1f9cf2f2 authored by Jean-Paul Saman's avatar Jean-Paul Saman

examples/connect.c: Resource leak (CID 28605)

parent fb280937
......@@ -93,7 +93,7 @@ int create_udp_connection( const char *ipaddress, int port )
if( !ipaddress ) return -1;
s_ctl = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s_ctl <= 0)
if (s_ctl < 0)
{
perror( "udp socket error" );
return -1;
......@@ -106,6 +106,7 @@ int create_udp_connection( const char *ipaddress, int port )
result = bind(s_ctl, (struct sockaddr*) &addr_ctl, sizeof(addr_ctl));
if( result < 0 )
{
close(s_ctl);
perror( "udp bind error" );
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment