Commit 57ef9e43 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

spdif: Use aout_FifoPop() which checks locking and fix a aout_FifoPop() leak.

Pointed-out-by a warning.
parent 1f22d722
......@@ -81,30 +81,19 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
int i = 0;
aout_input_t * p_input = p_aout->pp_inputs[i];
while ( p_input->b_error || p_input->b_paused )
{
p_input = p_aout->pp_inputs[++i];
}
aout_FifoPop( p_aout, &p_input->fifo );
aout_buffer_t * p_old_buffer = aout_FifoPop( p_aout, &p_input->fifo );
aout_BufferFree( p_old_buffer );
/* Empty other FIFOs to avoid a memory leak. */
for ( i++; i < p_aout->i_nb_inputs; i++ )
{
aout_fifo_t * p_fifo;
aout_buffer_t * p_deleted;
p_input = p_aout->pp_inputs[i];
if ( p_input->b_error || p_input->b_paused )
continue;
p_fifo = &p_input->fifo;
p_deleted = p_fifo->p_first;
while ( p_deleted != NULL )
{
aout_buffer_t * p_next = p_deleted->p_next;
aout_BufferFree( p_deleted );
p_deleted = p_next;
}
p_fifo->p_first = NULL;
p_fifo->pp_last = &p_fifo->p_first;
while ((p_old_buffer = aout_FifoPop( p_aout, &p_input->fifo )))
aout_BufferFree( p_old_buffer );
}
}
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