From 752d084609a20ab88fcf23ac42a5947809c4c678 Mon Sep 17 00:00:00 2001 From: Tamas TEVESZ Date: Tue, 28 Sep 2010 03:39:31 +0200 Subject: [PATCH] WINGs: Plug potential segfault ...following up on d65cb5a ("Preparing to do exactly as FIXME says"). Signed-off-by: Tamas TEVESZ --- WINGs/userdefaults.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c index ea5cceba..cb2cc051 100644 --- a/WINGs/userdefaults.c +++ b/WINGs/userdefaults.c @@ -51,20 +51,20 @@ char *wusergnusteppath() char *gspath; int pathlen; - if (!path) { - gspath = getenv("GNUSTEP_USER_ROOT"); + gspath = getenv("GNUSTEP_USER_ROOT"); + if (gspath) { + gspath = wexpandpath(gspath); if (gspath) { - gspath = wexpandpath(gspath); pathlen = strlen(gspath) + 4; path = wmalloc(pathlen); strcpy(path, gspath); wfree(gspath); - } else { - pathlen = strlen(wgethomedir()) + 10; - path = wmalloc(pathlen); - strcpy(path, wgethomedir()); - strcat(path, "/GNUstep"); } + } else { + pathlen = strlen(wgethomedir()) + 10; + path = wmalloc(pathlen); + strcpy(path, wgethomedir()); + strcat(path, "/GNUstep"); } return path; -- 2.11.4.GIT