Commit f8c5996f authored by gbazin's avatar gbazin
Browse files

* modules/stream_out/transcode.c, src/input/decoder.c, src/input/control.c:...

* modules/stream_out/transcode.c, src/input/decoder.c, src/input/control.c: fixed a bunch of memory leaks. Patch courtesy of Wallace Wadge (wwadge at gmail) + modifications by me.
parent 9da70ef6
......@@ -849,7 +849,11 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
id->id = p_sys->p_out->pf_add( p_sys->p_out, &id->p_encoder->fmt_out );
id->b_transcode = VLC_TRUE;
if( !id->id ) goto error;
if( !id->id )
{
transcode_audio_close( p_stream, id );
goto error;
}
date_Init( &id->interpolated_pts, p_fmt->audio.i_rate, 1 );
}
......@@ -904,7 +908,11 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
id->id = p_sys->p_out->pf_add( p_sys->p_out, &id->p_encoder->fmt_out );
id->b_transcode = VLC_TRUE;
if( !id->id ) goto error;
if( !id->id )
{
transcode_spu_close( p_stream, id );
goto error;
}
}
else if( p_fmt->i_cat == SPU_ES && p_sys->b_soverlay )
{
......@@ -955,6 +963,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
if( id->p_encoder )
{
vlc_object_detach( id->p_encoder );
es_format_Clean( &id->p_encoder->fmt_out );
vlc_object_destroy( id->p_encoder );
}
......@@ -996,6 +1005,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
if( id->p_encoder )
{
vlc_object_detach( id->p_encoder );
es_format_Clean( &id->p_encoder->fmt_out );
vlc_object_destroy( id->p_encoder );
}
......@@ -2352,13 +2362,13 @@ static int transcode_osd_new( sout_stream_t *p_stream, sout_stream_id_t *id )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
es_format_t fmt;
fmt.i_cat = SPU_ES;
fmt.i_id = 0xbd1f; /* pid ?? */
fmt.i_group = 3; /* pmt entry ?? */
fmt.i_codec = VLC_FOURCC( 'Y', 'U', 'V', 'A' );
fmt.psz_language = strdup( "osd" );
id = malloc( sizeof( sout_stream_id_t ) );
memset( id, 0, sizeof(sout_stream_id_t) );
......
......@@ -196,6 +196,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
NotifyPlaylist( p_input );
}
return VLC_SUCCESS;
case INPUT_DEL_INFO:
{
char *psz_cat = (char *)va_arg( args, char * );
......@@ -224,6 +225,10 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
{
if( !strcmp( p_cat->pp_infos[i]->psz_name, psz_name ) )
{
free( p_cat->pp_infos[i]->psz_name );
if( p_cat->pp_infos[i]->psz_value )
free( p_cat->pp_infos[i]->psz_value );
free( p_cat->pp_infos[i] );
REMOVE_ELEM( p_cat->pp_infos, p_cat->i_infos, i );
break;
}
......
......@@ -537,6 +537,8 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
p_dec->p_owner->sout.i_id = p_dec->fmt_in.i_id;
if( p_dec->fmt_in.psz_language )
{
if( p_dec->p_owner->sout.psz_language )
free( p_dec->p_owner->sout.psz_language );
p_dec->p_owner->sout.psz_language =
strdup( p_dec->fmt_in.psz_language );
}
......@@ -547,7 +549,8 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
if( p_dec->p_owner->p_sout_input == NULL )
{
msg_Err( p_dec, "cannot create packetizer output" );
msg_Err( p_dec, "cannot create packetizer output (%4.4s)",
(char *)&p_dec->p_owner->sout.i_codec );
p_dec->b_error = VLC_TRUE;
while( p_sout_block )
......
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