Commit 5cf35304 authored by Rémi Duraffort's avatar Rémi Duraffort

Fix memleak (#2351) (mvar_AppendNewVar already do a strdup of the value);

parent 82c1d83c
...@@ -414,16 +414,14 @@ mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name, ...@@ -414,16 +414,14 @@ mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name,
for( i = 0; i < val_list.p_list->i_count; i++ ) for( i = 0; i < val_list.p_list->i_count; i++ )
{ {
char *psz, psz_int[16]; char psz_int[16];
mvar_t *itm; mvar_t *itm;
switch( i_type & VLC_VAR_TYPE ) switch( i_type & VLC_VAR_TYPE )
{ {
case VLC_VAR_STRING: case VLC_VAR_STRING:
itm = mvar_New( name, "set" ); itm = mvar_New( name, "set" );
/* FIXME: Memory leak here?? (remove strdup?) */ mvar_AppendNewVar( itm, "name", text_list.p_list->p_values[i].psz_string );
psz = strdup( text_list.p_list->p_values[i].psz_string );
mvar_AppendNewVar( itm, "name", psz );
mvar_AppendNewVar( itm, "id", val_list.p_list->p_values[i].psz_string ); mvar_AppendNewVar( itm, "id", val_list.p_list->p_values[i].psz_string );
snprintf( psz_int, sizeof(psz_int), "%d", snprintf( psz_int, sizeof(psz_int), "%d",
( !strcmp( val.psz_string, ( !strcmp( val.psz_string,
...@@ -435,8 +433,7 @@ mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name, ...@@ -435,8 +433,7 @@ mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name,
case VLC_VAR_INTEGER: case VLC_VAR_INTEGER:
itm = mvar_New( name, "set" ); itm = mvar_New( name, "set" );
psz = strdup( text_list.p_list->p_values[i].psz_string ); mvar_AppendNewVar( itm, "name", text_list.p_list->p_values[i].psz_string );
mvar_AppendNewVar( itm, "name", psz );
snprintf( psz_int, sizeof(psz_int), "%d", snprintf( psz_int, sizeof(psz_int), "%d",
val_list.p_list->p_values[i].i_int ); val_list.p_list->p_values[i].i_int );
mvar_AppendNewVar( itm, "id", psz_int ); mvar_AppendNewVar( itm, "id", psz_int );
......
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