summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/filepath.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/filepath.c b/utils/filepath.c
index c07cc4874..87f9302f4 100644
--- a/utils/filepath.c
+++ b/utils/filepath.c
@@ -248,8 +248,14 @@ expand_path(const char *path, int pathlen)
explen - cloop);
explen -= replen;
} else {
+ char *tmp;
envlen = strlen(envv);
- exp = realloc(exp, explen + envlen - replen);
+ tmp = realloc(exp, explen + envlen - replen);
+ if (tmp == NULL) {
+ free(exp);
+ return NULL;
+ }
+ exp = tmp;
memmove(exp + cstart + envlen,
exp + cloop + 1,
explen - cloop );