]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcstr.c
Avoid crash when $HOME is not set
[fontconfig.git] / src / fcstr.c
index a51be35b71932e41aca74b5b614873ff0b4917e2..3a31b22584b976b4ef775c033eee4b3ed11487fe 100644 (file)
@@ -428,9 +428,10 @@ FcStrCopyFilename (const FcChar8 *s)
     if (*s == '~')
     {
        FcChar8 *home = (FcChar8 *) getenv ("HOME");
-       int     size = strlen ((char *) home) + strlen ((char *) s);
+       int     size;
        if (!home)
            return 0;
+       size = strlen ((char *) home) + strlen ((char *) s);
        new = (FcChar8 *) malloc (size);
        if (!new)
            return 0;