From: Keith Packard Date: Thu, 6 Feb 2003 19:30:32 +0000 (+0000) Subject: Avoid crash when $HOME is not set X-Git-Tag: fc-2_1_91~36 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=dda27aa9ee057d213956f18041bedb4648c6c302;p=fontconfig.git Avoid crash when $HOME is not set --- diff --git a/src/fcstr.c b/src/fcstr.c index a51be35..3a31b22 100644 --- a/src/fcstr.c +++ b/src/fcstr.c @@ -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;