Commit 02a64e24 authored by Jean-Paul Saman's avatar Jean-Paul Saman

examples/dvbinfo: do not use after free.

The param struct was used after it was freed.
parent 8139d078
...@@ -196,6 +196,7 @@ static void params_free(params_t *param) ...@@ -196,6 +196,7 @@ static void params_free(params_t *param)
free(param->input); free(param->input);
free(param->output); free(param->output);
free(param->summary.file); free(param->summary.file);
param = NULL;
} }
/* */ /* */
...@@ -646,7 +647,6 @@ int main(int argc, char **pp_argv) ...@@ -646,7 +647,6 @@ int main(int argc, char **pp_argv)
if (param->input == NULL) if (param->input == NULL)
{ {
libdvbpsi_log(param, DVBINFO_LOG_ERROR, "No source given\n"); libdvbpsi_log(param, DVBINFO_LOG_ERROR, "No source given\n");
params_free(param);
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
if (param->b_monitor) if (param->b_monitor)
closelog(); closelog();
...@@ -692,8 +692,6 @@ int main(int argc, char **pp_argv) ...@@ -692,8 +692,6 @@ int main(int argc, char **pp_argv)
dvbinfo_close(param); dvbinfo_close(param);
/* cleanup */ /* cleanup */
params_free(param);
fifo_wake((&capture)->fifo); fifo_wake((&capture)->fifo);
fifo_wake((&capture)->empty); fifo_wake((&capture)->empty);
...@@ -707,6 +705,8 @@ int main(int argc, char **pp_argv) ...@@ -707,6 +705,8 @@ int main(int argc, char **pp_argv)
if (param->b_monitor) if (param->b_monitor)
closelog(); closelog();
#endif #endif
params_free(param);
if (err < 0) if (err < 0)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
else else
......
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