examples/connect.c: Resource leak (CID 28605)
[email protected] (Jean-Paul Saman) Wed, 16 Apr 2014 15:53:38 +0200 (CEST)
| Newsgroups | gmane.comp.video.videolan.libdvbpsi.devel |
|---|---|
| Message-ID | <[email protected]> |
libdvbpsi | branch: master | Jean-Paul Saman <[email protected]> | Wed Apr 16 11:32:58 2014 +0200| [1f9cf2f251ed0ed9f4f135425934fa0a4938774c] | committer: Jean-Paul Saman examples/connect.c: Resource leak (CID 28605) > http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=1f9cf2f251ed0ed9f4f135425934fa0a4938774c --- examples/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/connect.c b/examples/connect.c index cb03a26..fa53902 100644 --- a/examples/connect.c +++ b/examples/connect.c @@ -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; } _______________________________________________ libdvbpsi-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libdvbpsi-devel