summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-09-30 14:28:47 +0200
committerJim Meyering <meyering@redhat.com>2012-09-30 14:34:20 +0200
commitfc20096ecbaa633354185d79745f7a56d3a53f93 (patch)
tree17483d9998cbb2a4df4ddc6f39c9e20d33fbdfaa /src
parent6072039fa48b4673f3591cea88a3188b16836a8e (diff)
downloadcoreutils-fc20096ecbaa633354185d79745f7a56d3a53f93.tar.xz
du: avoid abort on systems for which ->me_type is not malloc'd
On some systems (notably, BSD-based, like at least OpenBSD 4.9), the me_type member does not come from the heap. * src/du.c (fill_mount_table): Free the ->me_type member only when it was malloc'd, i.e., when ->me_type_malloced is nonzero. Bug introduced via commit v8.19-2-gcf7e1b5. Reported as http://bugs.gnu.org/12542.
Diffstat (limited to 'src')
-rw-r--r--src/du.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/du.c b/src/du.c
index ee90da9ba..63daaa928 100644
--- a/src/du.c
+++ b/src/du.c
@@ -660,7 +660,8 @@ fill_mount_table (void)
free (mnt_free->me_devname);
free (mnt_free->me_mountdir);
- free (mnt_free->me_type);
+ if (mnt_free->me_type_malloced)
+ free (mnt_free->me_type);
free (mnt_free);
}
}