GNU bug report logs - #12542
[PATCH] du: avoid abort on systems for which ->me_type is not malloc'd

Previous Next

Package: coreutils;

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

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jim Meyering <jim <at> meyering.net>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#12542: closed ([PATCH] du: avoid abort on systems for which
 ->me_type is not malloc'd)
Date: Sun, 30 Sep 2012 12:44:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 30 Sep 2012 14:43:18 +0200
with message-id <87vcevwujd.fsf <at> rho.meyering.net>
and subject line Re: bug#12542: [PATCH] du: avoid abort on systems for which ->me_type is not malloc'd
has caused the debbugs.gnu.org bug report #12542,
regarding [PATCH] du: avoid abort on systems for which ->me_type is not malloc'd
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> 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)]
From: Jim Meyering <jim <at> meyering.net>
To: bug-coreutils <at> gnu.org
Subject: [PATCH] du: avoid abort on systems for which ->me_type is not malloc'd
Date: Sun, 30 Sep 2012 14:32:35 +0200
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


[Message part 3 (message/rfc822, inline)]
From: Jim Meyering <jim <at> meyering.net>
To: 12542-done <at> debbugs.gnu.org
Subject: Re: bug#12542: [PATCH] du: avoid abort on systems for which ->me_type
	is not malloc'd
Date: Sun, 30 Sep 2012 14:43:18 +0200
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.


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.