]> git.sesse.net Git - vlc/commitdiff
freetype: use asprintf instead malloc/sprintf
authorIlkka Ollakka <ileoo@videolan.org>
Mon, 27 Jul 2009 08:25:54 +0000 (11:25 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Mon, 27 Jul 2009 08:26:41 +0000 (11:26 +0300)
modules/misc/freetype.c

index 388ea5ac96a9ac332cd50e614f2973c5be49c926..972845b9e2a3e704850d5f8ed99b4083aeb03a27 100644 (file)
@@ -357,11 +357,9 @@ static int Create( vlc_object_t *p_this )
 
 #ifdef HAVE_FONTCONFIG
     /* Lets find some fontfile from freetype-font variable family */
-    char *psz_fontsize = malloc( 4 );
-    if( !psz_fontsize )
+    char *psz_fontsize;
+    if( asprintf( &psz_fontsize, "%d", p_sys->i_default_font_size ) == -1 )
         goto error;
-
-    snprintf( psz_fontsize, 4, "%d", p_sys->i_default_font_size );
     fontpattern = FcPatternCreate();
     FcPatternAddString( fontpattern, FC_FAMILY, psz_fontfamily);
     FcPatternAddString( fontpattern, FC_SIZE, psz_fontsize );