GNU bug report logs - #13098
[PATCH] cut.c: Fix memory leak

Previous Next

Package: coreutils;

Reported by: Cojocaru Alexandru <xojoc <at> gmx.com>

Date: Thu, 6 Dec 2012 02:17:01 UTC

Severity: normal

Tags: patch

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 13098 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: 13098 <at> debbugs.gnu.org
Cc: xojoc <at> gmx.com, P <at> draigBrady.com
Subject: Re: bug#13098: [PATCH] cut.c: Fix memory leak
Date: Fri, 07 Dec 2012 05:32:53 +0100
Pádraig Brady wrote:
...
> How about the attached?

> From: Cojocaru Alexandru <xojoc <at> gmx.com>
> Date: Thu, 6 Dec 2012 03:03:41 +0100
> Subject: [PATCH] cut: avoid a redundant heap allocation
>
> * src/cut.c (set_fields): Don't allocate memory for
> `printable_field' if there are no finite ranges.
> The extra allocation was introduced via commit v8.10-3-g2e636af.
...

Thanks to both of you.
That's a fine bug fix, actually.
Consider that before, this would fail on my 64-bit system:

    $ : | cut -b999999999999999999-
    cut: memory exhausted
    [Exit 1]
    $

Now, it no longer tries to allocate all that memory, so completes normally:

    $ : | cut -b999999999999999999-
    $




This bug report was last modified 12 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.