[vlc-devel] commit: Fix memory leak (CID 96) ( Rafaël Carré )
git version control
git at videolan.org
Mon Jun 9 09:26:54 CEST 2008
vlc | branch: 0.8.6-bugfix | Rafaël Carré <funman at videolan.org> | Mon Jun 9 09:28:27 2008 +0200| [86132d3da715af4a29e2723d2c2e92c26915e8a5]
Fix memory leak (CID 96)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=86132d3da715af4a29e2723d2c2e92c26915e8a5
---
src/input/input.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/input/input.c b/src/input/input.c
index 9c83245..28ad31e 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1916,18 +1916,19 @@ static int UpdateMeta( input_thread_t *p_input, vlc_bool_t b_quick )
if( tk->i_meta > 0 )
{
- char *psz_cat = malloc( strlen(_("Stream")) + 10 );
-
msg_Dbg( p_input, " - track[%d]:", i );
-
- sprintf( psz_cat, "%s %d", _("Stream"), i );
- for( j = 0; j < tk->i_meta; j++ )
+ char *psz_cat;
+ if( asprintf( &psz_cat, "%s %d", _("Stream"), i ) != -1 )
{
- msg_Dbg( p_input, " - '%s' = '%s'", _(tk->name[j]),
- tk->value[j] );
+ for( j = 0; j < tk->i_meta; j++ )
+ {
+ msg_Dbg( p_input, " - '%s' = '%s'", _(tk->name[j]),
+ tk->value[j] );
- input_Control( p_input, INPUT_ADD_INFO, psz_cat,
- _(tk->name[j]), "%s", tk->value[j] );
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat,
+ _(tk->name[j]), "%s", tk->value[j] );
+ }
+ free( psz_cat );
}
}
}
More information about the vlc-devel
mailing list