Commit c68890a4 authored by Jean-Paul Saman's avatar Jean-Paul Saman

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

Check filedescriptors for having a valid value.
parent 61a70397
...@@ -214,15 +214,15 @@ static void params_free(params_t *param) ...@@ -214,15 +214,15 @@ static void params_free(params_t *param)
static void dvbinfo_close(params_t *param) static void dvbinfo_close(params_t *param)
{ {
#ifdef HAVE_SYS_SOCKET_H #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); 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); tcp_close(param->fd_in);
else else
#endif #endif
if (param->input) if (param->input && (param->fd_in >= 0))
close(param->fd_in); close(param->fd_in);
if (param->output) if (param->output && (param->fd_out >= 0))
close(param->fd_out); close(param->fd_out);
} }
......
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