Commit fcedf52d authored by Michael Tänzer's avatar Michael Tänzer Committed by Jean-Baptiste Kempf

ogg codecs: use checked realloc() instead of xrealloc()

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 37a9c77b
......@@ -380,9 +380,15 @@ static int ProcessHeaders( decoder_t *p_dec )
}
else
{
void* p_extra = realloc( p_dec->fmt_out.p_extra,
p_dec->fmt_in.i_extra );
if( unlikely( p_extra == NULL ) )
{
ret = VLC_ENOMEM;
goto cleanup;
}
p_dec->fmt_out.p_extra = p_extra;
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
......
......@@ -592,9 +592,14 @@ static int ProcessHeaders( decoder_t *p_dec )
#ifdef ENABLE_PACKETIZER
else
{
void* p_extra = realloc( p_dec->fmt_out.p_extra,
p_dec->fmt_in.i_extra );
if( unlikely( p_extra == NULL ) )
{
return VLC_ENOMEM;
}
p_dec->fmt_out.p_extra = p_extra;
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
......
......@@ -250,9 +250,13 @@ static int ProcessHeader(decoder_t* p_dec)
* latter are underspecified. */
if (p_sys->b_packetizer) {
void* p_extra = realloc(p_dec->fmt_out.p_extra,
p_dec->fmt_in.i_extra);
if (unlikely(p_extra == NULL)) {
return VLC_ENOMEM;
}
p_dec->fmt_out.p_extra = p_extra;
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
p_dec->fmt_out.p_extra = xrealloc(p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra);
memcpy(p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra);
}
......
......@@ -424,9 +424,14 @@ static int ProcessHeaders( decoder_t *p_dec )
if( p_sys->b_packetizer )
{
void* p_extra = realloc( p_dec->fmt_out.p_extra,
p_dec->fmt_in.i_extra );
if( unlikely( p_extra == NULL ) )
{
return VLC_ENOMEM;
}
p_dec->fmt_out.p_extra = p_extra;
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
......
......@@ -399,9 +399,16 @@ static int ProcessHeaders( decoder_t *p_dec )
}
else
{
void* p_extra = realloc( p_dec->fmt_out.p_extra,
p_dec->fmt_in.i_extra );
if( unlikely( p_extra == NULL ) )
{
/* Clean up the decoder setup info... we're done with it */
th_setup_free( ts );
return VLC_ENOMEM;
}
p_dec->fmt_out.p_extra = p_extra;
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
......
......@@ -414,9 +414,14 @@ static int ProcessHeaders( decoder_t *p_dec )
}
else
{
void* p_extra = realloc( p_dec->fmt_out.p_extra,
p_dec->fmt_in.i_extra );
if( unlikely( p_extra == NULL ) )
{
return VLC_ENOMEM;
}
p_dec->fmt_out.p_extra = p_extra;
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
......
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