Commit ba0b1020 authored by Rémi Duraffort's avatar Rémi Duraffort

avi: do not allocate memory of size 0 (if i_extra == 0, p_extra is not released).

parent 4d85871d
......@@ -437,9 +437,12 @@ static int Open( vlc_object_t * p_this )
fmt.i_extra = __MIN( p_auds->p_wf->cbSize,
p_auds->i_chunk_size - sizeof(WAVEFORMATEX) );
fmt.p_extra = malloc( fmt.i_extra );
if( !fmt.p_extra ) goto error;
memcpy( fmt.p_extra, &p_auds->p_wf[1], fmt.i_extra );
if( fmt.i_extra > 0 )
{
fmt.p_extra = malloc( fmt.i_extra );
if( !fmt.p_extra ) goto error;
memcpy( fmt.p_extra, &p_auds->p_wf[1], fmt.i_extra );
}
break;
case( AVIFOURCC_vids ):
......@@ -512,9 +515,12 @@ static int Open( vlc_object_t * p_this )
fmt.i_extra =
__MIN( p_vids->p_bih->biSize - sizeof( BITMAPINFOHEADER ),
p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER) );
fmt.p_extra = malloc( fmt.i_extra );
if( !fmt.p_extra ) goto error;
memcpy( fmt.p_extra, &p_vids->p_bih[1], fmt.i_extra );
if( fmt.i_extra > 0 )
{
fmt.p_extra = malloc( fmt.i_extra );
if( !fmt.p_extra ) goto error;
memcpy( fmt.p_extra, &p_vids->p_bih[1], fmt.i_extra );
}
msg_Dbg( p_demux, "stream[%d] video(%4.4s) %"PRIu32"x%"PRIu32" %dbpp %ffps",
i, (char*)&p_vids->p_bih->biCompression,
......
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