From 4ca43f740922fb01134c0b231c31a3d512b1cc46 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Tue, 12 Aug 2008 16:41:12 -0700 Subject: [PATCH] osd_text: Fix a bad vasprintf usage. --- src/osd/osd_text.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/osd/osd_text.c b/src/osd/osd_text.c index 2386d30e3c..914b75a5e7 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 ); } } -- 2.39.2