]> git.sesse.net Git - vlc/commitdiff
osd_text: Fix a bad vasprintf usage.
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 12 Aug 2008 23:41:12 +0000 (16:41 -0700)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 12 Aug 2008 23:43:07 +0000 (16:43 -0700)
src/osd/osd_text.c

index 2386d30e3c799f709fa5f7f8e85c783a1e8b866f..914b75a5e7fb6b016a97178d54c20d6a2d35f2f7 100644 (file)
@@ -123,18 +123,20 @@ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
 void osd_Message( spu_t *p_spu, int i_channel,
                         char *psz_format, ... )
 {
-    char *psz_string;
     va_list args;
 
     if( p_spu )
     {
+        char *psz_string;
         va_start( args, psz_format );
-        vasprintf( &psz_string, psz_format, args );
+        if( vasprintf( &psz_string, psz_format, args ) != -1 )
+        {
 
-        osd_ShowTextRelative( p_spu, i_channel, psz_string, NULL,
-                               OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,1000000 );
+            osd_ShowTextRelative( p_spu, i_channel, psz_string, NULL,
+                    OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,1000000 );
 
-        free( psz_string );
+            free( psz_string );
+        }
         va_end( args );
     }
 }