From: Jim Meyering Date: Sun, 30 Sep 2012 12:28:47 +0000 (+0200) Subject: du: avoid abort on systems for which ->me_type is not malloc'd X-Git-Tag: v8.20~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc20096ecbaa633354185d79745f7a56d3a53f93;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/src/du.c b/src/du.c index ee90da9bae..63daaa9284 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); } }