[vlc-devel] commit: Check asprintf return (Jean-Baptiste Kempf )

git version control git at videolan.org
Wed Dec 16 11:27:14 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Dec 16 11:03:22 2009 +0100| [922f8c8499f244a3f03316aa7ea0e7592b29d672] | committer: Jean-Baptiste Kempf 

Check asprintf return

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

 modules/control/http/util.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/control/http/util.c b/modules/control/http/util.c
index d7d7cb4..f1d06cf 100644
--- a/modules/control/http/util.c
+++ b/modules/control/http/util.c
@@ -953,10 +953,12 @@ char *RealPath( const char *psz_src )
     if( psz_dir[0] == '~' )
     {
         char *home = config_GetUserDir( VLC_HOME_DIR ), *dir;
-        asprintf( &dir, "%s%s", home, psz_dir + 1 );
-        free( psz_dir );
+        if( asprintf( &dir, "%s%s", home, psz_dir + 1 ) != -1 )
+        {
+            free( psz_dir );
+            psz_dir = dir;
+        }
         free( home );
-        psz_dir = dir;
     }
 
     if( strlen(psz_dir) > 2 )




More information about the vlc-devel mailing list