[MPlayer-dev-eng] [PATCH] ao_alsa alsa_device string handling fixes

Alexander Strasser eclipse7 at gmx.net
Sun Jun 27 22:21:53 CEST 2004


Hi,

> ao_alsa does some very bad things with alsa_device.
> 1) char *alsa_device is defined globally although alloca is used to 
> allocate memory for it, meaning it is undefined outside this function.
> 
yes.

> the attached patch should improve things a bit.
> Alexander (beastd), maybe you could check this, you already have some 
> experince with that ;-)
>
Your patch is ok imho, though it doesn't address all problems as you said.
I'll try to have a look at it in the next days, if you are already doing
that tell me.

The string oprations you corrected can be assumed safe by now, and `why'
is also documented ( new rule, in patches.txt :) .

And that you also removed alloca() is good, it's use was irritating and
dangerous in combination with the variable global to that file. And
as far as i can tell it it wasn't useful at all, because it didn't
allocate a dynamic size and thus had no advantages over a normal array.
Btw the NULL checking of alloca is normally useless because it doesn't
check for stacksize and just makes the stack overflow if too much memory
is allocated, at least in most implementations.

  Alex ( beastd )




More information about the MPlayer-dev-eng mailing list