[vlc-commits] config_GetTypeDir() : don't call strlen(NULL) if HOME is not set

Rafaël Carré git at videolan.org
Tue Aug 30 14:54:33 CEST 2011


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Tue Aug 30 08:53:22 2011 -0400| [eb8d2024f5bbe38d9eaa20fbfbba23982636fb82] | committer: Rafaël Carré

config_GetTypeDir() : don't call strlen(NULL) if HOME is not set

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

 src/posix/dirs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/posix/dirs.c b/src/posix/dirs.c
index d3468ff..ef51766 100644
--- a/src/posix/dirs.c
+++ b/src/posix/dirs.c
@@ -117,7 +117,6 @@ static char *config_GetTypeDir (const char *xdg_name)
 {
     const size_t namelen = strlen (xdg_name);
     const char *home = getenv ("HOME");
-    const size_t homelen = strlen (home);
     const char *dir = getenv ("XDG_CONFIG_HOME");
     const char *file = "user-dirs.dirs";
 
@@ -174,6 +173,7 @@ static char *config_GetTypeDir (const char *xdg_name)
             }
             else
             {   /* Prefix with $HOME */
+                const size_t homelen = strlen (home);
                 ptr += 5;
                 path = malloc (homelen + linelen - 5);
                 if (path == NULL)



More information about the vlc-commits mailing list