diff options
Diffstat (limited to 'bin/df/df.c')
-rw-r--r-- | bin/df/df.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/df/df.c b/bin/df/df.c index 77c2d28..f244c26 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -548,8 +548,10 @@ makenetvfslist() } } - if ((str = malloc(sizeof(char) * (32 * cnt + cnt + 2))) == NULL) { - warnx("malloc failed"); + if (cnt == 0 || + (str = malloc(sizeof(char) * (32 * cnt + cnt + 2))) == NULL) { + if (cnt > 0) + warnx("malloc failed"); free(listptr); return (NULL); } |