summaryrefslogtreecommitdiff
path: root/utils/filepath.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/filepath.c')
-rw-r--r--utils/filepath.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/filepath.c b/utils/filepath.c
index 87f9302f4..9368c216c 100644
--- a/utils/filepath.c
+++ b/utils/filepath.c
@@ -181,7 +181,8 @@ filepath_generate(char * const *pathv, const char * const *langv)
respath = calloc(MAX_RESPATH, sizeof(char *));
- while (pathv[pathc] != NULL) {
+ while ((respath != NULL) &&
+ (pathv[pathc] != NULL)) {
if ((stat(pathv[pathc], &dstat) == 0) &&
S_ISDIR(dstat.st_mode)) {
/* path element exists and is a directory */
@@ -199,7 +200,6 @@ filepath_generate(char * const *pathv, const char * const *langv)
}
pathc++;
}
-
return respath;
}