[vlc-devel] commit: osd_text: Fix a bad vasprintf usage. (Jean-Baptiste Kempf )

git version control git at videolan.org
Wed Aug 13 01:40:15 CEST 2008


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Aug 12 16:41:12 2008 -0700| [4ca43f740922fb01134c0b231c31a3d512b1cc46] | committer: Jean-Baptiste Kempf 

osd_text: Fix a bad vasprintf usage.

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

 src/osd/osd_text.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/osd/osd_text.c b/src/osd/osd_text.c
index 2386d30..914b75a 100644
--- a/src/osd/osd_text.c
+++ b/src/osd/osd_text.c
@@ -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 );
     }
 }




More information about the vlc-devel mailing list