[vlc-devel] commit: Fix use of realloc and remove dead code. (Jean-Paul Saman )
Jean-Paul Saman
jpsaman at videolan.org
Thu Nov 27 10:31:22 CET 2008
Laurent Aimar wrote:
> On Thu, Nov 27, 2008, git version control wrote:
>>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=22d094d937c96919a490bcef3f498feade0cf730
>> ---
>>
>> src/input/es_out.c | 18 ++++++------------
>> 1 files changed, 6 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/input/es_out.c b/src/input/es_out.c
>> index 1319e05..ba33a1b 100644
>> --- a/src/input/es_out.c
>> +++ b/src/input/es_out.c
>> @@ -1579,7 +1579,7 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
>> {
>> es_out_sys_t *p_sys = out->p_sys;
>> bool b, *pb;
>> - int i, *pi;
>> + int i, *pi;
>>
>> es_out_id_t *es;
>>
>> @@ -1831,26 +1831,20 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
>>
>> if( p_fmt->i_extra )
>> {
>> + uint8_t *p_tmp;
>> es->fmt.i_extra = p_fmt->i_extra;
>> - es->fmt.p_extra = realloc( es->fmt.p_extra, p_fmt->i_extra );
>> + p_tmp = realloc( es->fmt.p_extra, p_fmt->i_extra );
>> + if( !p_tmp )
>> + return VLC_ENOMEM;
> If you want to do it correctly, you must not change es->fmt.i_extra when the
> realloc fails...
>
Oops you are right I overlooked this one. Usually I move the
es->fmt.i_extra after the realloc.
Gtz
Jean-Paul Saman.
More information about the vlc-devel
mailing list