examples/connect.c: Resource leak (CID 28604)
[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:30:22 2014 +0200| [fb280937ae8c2f9485c21c086614d9fbf7390f09] | committer: Jean-Paul Saman examples/connect.c: Resource leak (CID 28604) > http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=fb280937ae8c2f9485c21c086614d9fbf7390f09 --- examples/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/connect.c b/examples/connect.c index 4f6e102..cb03a26 100644 --- a/examples/connect.c +++ b/examples/connect.c @@ -53,7 +53,7 @@ int create_tcp_connection( const char *ipaddress, int port ) if( !ipaddress ) return -1; s_ctl = socket( PF_INET, SOCK_STREAM, 0 ); - if (s_ctl <= 0) + if (s_ctl < 0) { perror( "tcp socket error" ); return -1; @@ -67,6 +67,7 @@ int create_tcp_connection( const char *ipaddress, int port ) if( result < 0 ) { perror( "tcp connect error" ); + close(s_ctl); return -1; } _______________________________________________ libdvbpsi-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libdvbpsi-devel