GNU bug report logs - #79328
expr: memory not freed before program exit(memory leak)

Previous Next

Package: coreutils;

Reported by: yubiao hu <huyubiaox <at> gmail.com>

Date: Thu, 28 Aug 2025 07:24:02 UTC

Severity: normal

Tags: notabug, patch

Merged with 79331

Found in version 9.4

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Full log


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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Collin Funk <collin.funk1 <at> gmail.com>, yubiao hu <huyubiaox <at> gmail.com>
Cc: 79328 <at> debbugs.gnu.org
Subject: Re: bug#79328: expr: memory not freed before program exit(memory leak)
Date: Thu, 28 Aug 2025 06:48:24 -0700
On 2025-08-28 01:08, Collin Funk wrote:
> Most (all?) of the programs in Coreutils will not free memory before
> exit, since it just takes extra time for no benefit.

Not only does it take extra time (and sometimes even space!), it makes 
the programs slightly less reliable because if there are bugs elsewhere 
the calls to 'free' can have undefined behavior. And this makes for more 
maintenance burden, since developers therefore have to verify that these 
other bugs cannot occur.

The idea that programmers ought to carefully free everything just before 
exit, merely to pacify a leak sanitizer, is misguided and counterproductive.




This bug report was last modified 12 days ago.

Previous Next


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