[vlc-devel] commit: spdif: Use aout_FifoPop() which checks locking and fix a aout_FifoPop() leak. (Pierre d'Herbemont )
git version control
git at videolan.org
Thu Aug 20 11:31:19 CEST 2009
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Thu Aug 20 11:11:51 2009 +0200| [57ef9e4388273fa19d0b67c5bdf3198b89c19aa0] | committer: Pierre d'Herbemont
spdif: Use aout_FifoPop() which checks locking and fix a aout_FifoPop() leak.
Pointed-out-by a warning.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=57ef9e4388273fa19d0b67c5bdf3198b89c19aa0
---
modules/audio_mixer/spdif.c | 21 +++++----------------
1 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/modules/audio_mixer/spdif.c b/modules/audio_mixer/spdif.c
index 6eb0665..9e93542 100644
--- a/modules/audio_mixer/spdif.c
+++ b/modules/audio_mixer/spdif.c
@@ -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 );
}
}
More information about the vlc-devel
mailing list