[vlc-devel] commit: freetype: use asprintf instead malloc/sprintf (Ilkka Ollakka )

git version control git at videolan.org
Mon Jul 27 10:56:52 CEST 2009


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Mon Jul 27 11:25:54 2009 +0300| [13b524c5f0f5382ff11d422b9eac8f552f6c12c5] | committer: Ilkka Ollakka 

freetype: use asprintf instead malloc/sprintf

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=13b524c5f0f5382ff11d422b9eac8f552f6c12c5
---

 modules/misc/freetype.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index 388ea5a..972845b 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -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 );




More information about the vlc-devel mailing list