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

examples/get_pcr_pid.c: fix leaking of memory

The cleanup paths forgot to cleanup the allocated libdvbpsi handles.
parent d6bdd063
......@@ -228,20 +228,22 @@ int main( int i_argc, char **pp_argv )
for( int i = 0; i < MAX_PROGRAMS; i++)
{
dvbpsi_DetachPMT(p_pmt_dvbpsi_fds[i]);
dvbpsi_DeleteHandle(p_pmt_dvbpsi_fds[i]);
if (p_pmt_dvbpsi_fds[i])
{
dvbpsi_DetachPMT(p_pmt_dvbpsi_fds[i]);
dvbpsi_DeleteHandle(p_pmt_dvbpsi_fds[i]);
}
p_pmt_dvbpsi_fds[i] = NULL;
}
result = EXIT_SUCCESS;
out:
if (p_dvbpsi == NULL)
if (p_dvbpsi)
{
dvbpsi_DetachPAT(p_dvbpsi);
dvbpsi_DeleteHandle(p_dvbpsi);
}
close( i_fd );
fprintf( stderr, "no PAT/PMT found\n" );
return result;
}
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