Commit 27edb261 authored by Rémi Duraffort's avatar Rémi Duraffort

Fix memleak (same problem with var_Change(VLC_VAR_FREELIST)).

parent 25070505
...@@ -441,13 +441,13 @@ int libvlc_audio_get_track( libvlc_media_player_t *p_mi, ...@@ -441,13 +441,13 @@ int libvlc_audio_get_track( libvlc_media_player_t *p_mi,
var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL ); var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL );
for( i = 0; i < val_list.p_list->i_count; i++ ) for( i = 0; i < val_list.p_list->i_count; i++ )
{ {
vlc_value_t track_val = val_list.p_list->p_values[i]; if( val_list.p_list->p_values[i].i_int == val.i_int )
if( track_val.i_int == val.i_int )
{ {
i_track = i; i_track = i;
break; break;
} }
} }
var_Change( p_input_thread, "audio-es", VLC_VAR_FREELIST, &val_list, NULL );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
return i_track; return i_track;
} }
...@@ -470,16 +470,16 @@ void libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track, ...@@ -470,16 +470,16 @@ void libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track,
if( (i_track < 0) && (i_track > val_list.p_list->i_count) ) if( (i_track < 0) && (i_track > val_list.p_list->i_count) )
{ {
libvlc_exception_raise( p_e, "Audio track out of range" ); libvlc_exception_raise( p_e, "Audio track out of range" );
vlc_object_release( p_input_thread ); goto end;
return;
} }
newval = val_list.p_list->p_values[i_track]; newval = val_list.p_list->p_values[i_track];
i_ret = var_Set( p_input_thread, "audio-es", newval ); i_ret = var_Set( p_input_thread, "audio-es", newval );
if( i_ret < 0 ) if( i_ret < 0 )
{
libvlc_exception_raise( p_e, "Setting audio track failed" ); libvlc_exception_raise( p_e, "Setting audio track failed" );
}
end:
var_Change( p_input_thread, "audio-es", VLC_VAR_FREELIST, &val_list, NULL );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
} }
......
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