[libdvbpsi-devel] examples/dvbinfo/dvbinfo.c: Fix CID 17256, CID 172577 and CID 172578

Jean-Paul Saman git at videolan.org
Wed Apr 16 15:53:33 CEST 2014


libdvbpsi | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Fri Apr 11 16:21:31 2014 +0200| [c68890a40f4a87981ef5459cd4c0ab7d1d0f20a8] | committer: Jean-Paul Saman

examples/dvbinfo/dvbinfo.c: Fix CID 17256, CID 172577 and CID 172578

Check filedescriptors for having a valid value.

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=c68890a40f4a87981ef5459cd4c0ab7d1d0f20a8
---

 examples/dvbinfo/dvbinfo.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/dvbinfo/dvbinfo.c b/examples/dvbinfo/dvbinfo.c
index 390f38e..f7d69fe 100644
--- a/examples/dvbinfo/dvbinfo.c
+++ b/examples/dvbinfo/dvbinfo.c
@@ -214,15 +214,15 @@ static void params_free(params_t *param)
 static void dvbinfo_close(params_t *param)
 {
 #ifdef HAVE_SYS_SOCKET_H
-    if (param->input && param->b_udp)
+    if (param->input && param->b_udp && (param->fd_in >= 0))
         udp_close(param->fd_in);
-    else if (param->input && param->b_tcp)
+    else if (param->input && param->b_tcp && (param->fd_in >= 0))
         tcp_close(param->fd_in);
     else
 #endif
-    if (param->input)
+    if (param->input && (param->fd_in >= 0))
         close(param->fd_in);
-    if (param->output)
+    if (param->output && (param->fd_out >= 0))
         close(param->fd_out);
 }
 



More information about the libdvbpsi-devel mailing list