[vlc-devel] commit: Fixed segfault with spdif mixer. (Laurent Aimar )

Pierre d'Herbemont pdherbemont at gmail.com
Thu Sep 3 23:33:51 CEST 2009


On Sep 3, 2009, at 10:40 PM, git version control wrote:

> vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu  
> Sep  3 22:37:16 2009 +0200|  
> [790f188af5f0855128521eaba799a38881be2404] | committer: Laurent Aimar
>
> Fixed segfault with spdif mixer.
>
> The aout core use a hack to avoid useless memcpy: the buffer in which
> to mix is the same as the one in the first active input fifo.
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=790f188af5f0855128521eaba799a38881be2404
> ---
>
> modules/audio_mixer/spdif.c |    4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/modules/audio_mixer/spdif.c b/modules/audio_mixer/spdif.c
> index 0af800f..f06fad2 100644
> --- a/modules/audio_mixer/spdif.c
> +++ b/modules/audio_mixer/spdif.c
> @@ -29,6 +29,8 @@
> # include "config.h"
> #endif
>
> +#include <assert.h>
> +
> #include <vlc_common.h>
> #include <vlc_plugin.h>
> #include <vlc_aout.h>
> @@ -84,7 +86,7 @@ static void DoWork( aout_mixer_t * p_mixer,  
> aout_buffer_t * p_buffer )
>         p_input = p_mixer->input[++i];
>
>     aout_buffer_t * p_old_buffer = aout_FifoPop( NULL, &p_input- 
> >fifo );
> -    aout_BufferFree( p_old_buffer );
> +    assert( p_old_buffer == p_buffer );

While the assert is required, I would make this explicit by adding a  
comment here. I think I might have introduced this extra free, on  
purpose, because this API abuse wasn't documented.

I added a comment in [acac887] to explain why there is no free, please  
fix it if it is not exact.

Pierre.




More information about the vlc-devel mailing list