]> git.sesse.net Git - vlc/commitdiff
video_output: fix 4 bytes too short memory allocation
authorRafaël Carré <funman@videolan.org>
Sun, 21 Oct 2007 12:16:45 +0000 (12:16 +0000)
committerRafaël Carré <funman@videolan.org>
Sun, 21 Oct 2007 12:16:45 +0000 (12:16 +0000)
src/video_output/video_output.c

index 623dcfa421107fa962e9af7e1c8a937feaad8188..a0c80c5aa6969c73a61d55a16c057df05258e169 100644 (file)
@@ -1665,12 +1665,8 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout )
         else if( !EMPTY_STR( psz_artist ) )
         {
             char *psz_string = NULL;
-
-            psz_string = malloc( strlen( psz_name ) + strlen( psz_artist ) );
-            if( psz_string )
+            if( asprintf( &psz_string, "%s - %s", psz_name, psz_artist ) != -1 )
             {
-                sprintf( psz_string, "%s - %s", psz_name, psz_artist );
-
                 vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
                                        psz_string, NULL,
                                        p_vout->i_title_position,