From dda27aa9ee057d213956f18041bedb4648c6c302 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 6 Feb 2003 19:30:32 +0000 Subject: [PATCH] Avoid crash when $HOME is not set --- src/fcstr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;