summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-02-09 10:31:46 +0000
committerVincent Sanders <vince@kyllikki.org>2016-02-09 10:31:46 +0000
commit9610dbd2108e62f83f5bee3d6ea55fcac5d39e0a (patch)
treea284014fbb3199ea18c89bae5f5d8cf17c0d3f25 /utils
parent1a6408ab6300d7fa29e592478dd043288aad2f8b (diff)
downloadnetsurf-9610dbd2108e62f83f5bee3d6ea55fcac5d39e0a.tar.gz
netsurf-9610dbd2108e62f83f5bee3d6ea55fcac5d39e0a.tar.bz2
remove possible null dereference on allocation faliure
fix null dereference is calloc fails. coverity 1316339
Diffstat (limited to 'utils')
-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;
}