]> git.wh0rd.org - fontconfig.git/commitdiff
Avoid crash when $HOME is not set
authorKeith Packard <keithp@keithp.com>
Thu, 6 Feb 2003 19:30:32 +0000 (19:30 +0000)
committerKeith Packard <keithp@keithp.com>
Thu, 6 Feb 2003 19:30:32 +0000 (19:30 +0000)
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;