[libdvbpsi-devel] examples/connect.c: Resource leak (CID 28604)
Jean-Paul Saman
git at videolan.org
Wed Apr 16 15:53:38 CEST 2014
libdvbpsi | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | 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;
}
More information about the libdvbpsi-devel
mailing list