Commit 75e43e2b authored by Gildas Bazin's avatar Gildas Bazin

* src/misc/variables: fixed mem-leak for VLC_VAR_CLEARCHOICES.

parent 8ce86495
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variables.c: routines for object variables handling * variables.c: routines for object variables handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2004 VideoLAN * Copyright (C) 2002-2004 VideoLAN
* $Id: variables.c,v 1.38 2004/02/29 13:08:56 gbazin Exp $ * $Id$
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -501,11 +501,18 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -501,11 +501,18 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
{ {
p_var->pf_free( &p_var->choices.p_values[i] ); p_var->pf_free( &p_var->choices.p_values[i] );
} }
if( p_var->choices.i_count ) for( i = 0 ; i < p_var->choices_text.i_count ; i++ )
free( p_var->choices.p_values ); {
if( p_var->choices_text.p_values[i].psz_string )
free( p_var->choices_text.p_values[i].psz_string );
}
if( p_var->choices.i_count ) free( p_var->choices.p_values );
if( p_var->choices_text.i_count ) free( p_var->choices_text.p_values );
p_var->choices.i_count = 0; p_var->choices.i_count = 0;
p_var->choices.p_values = NULL; p_var->choices.p_values = NULL;
p_var->choices_text.i_count = 0;
p_var->choices_text.p_values = NULL;
p_var->i_default = -1; p_var->i_default = -1;
break; break;
case VLC_VAR_SETDEFAULT: case VLC_VAR_SETDEFAULT:
......
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