GNU bug report logs -
#12542
[PATCH] du: avoid abort on systems for which ->me_type is not malloc'd
Previous Next
Reported by: Jim Meyering <jim <at> meyering.net>
Date: Sun, 30 Sep 2012 12:34:02 UTC
Severity: normal
Tags: patch
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#12542: [PATCH] du: avoid abort on systems for which ->me_type is not malloc'd
which was filed against the coreutils package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 12542 <at> debbugs.gnu.org.
--
12542: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12542
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Jim Meyering wrote:
> I noticed that "make check" was failing a fundamental test of du
> on OpenBSD. It would have been trivial to diagnose with valgrind,
> but that tool wasn't easily available on the affected system...
I've just pushed the patch.
A better one should come soon, in which I add
a function in mountlist.c (declared in the .h file)
by which to encapsulate this mount-entry freeing process.
[Message part 3 (message/rfc822, inline)]
I noticed that "make check" was failing a fundamental test of du
on OpenBSD. It would have been trivial to diagnose with valgrind,
but that tool wasn't easily available on the affected system...
[I'm reporting this to the bug- mailing list, since I suppose we
should report all bugs there. ]
From caaf7cce39828ef3e90766fe2d6cc64559c13a60 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering <at> redhat.com>
Date: Sun, 30 Sep 2012 14:28:47 +0200
Subject: [PATCH] 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.
---
src/du.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/du.c b/src/du.c
index ee90da9..63daaa9 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);
}
}
--
1.7.12.1.382.gb0576a6
This bug report was last modified 12 years and 287 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.