GNU bug report logs - #79331
[PATCH] expr: fix memory leaks

Previous Next

Package: coreutils;

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

Date: Thu, 28 Aug 2025 15:06:03 UTC

Severity: normal

Tags: notabug, patch

Merged with 79328

Found in version 9.4

Done: Collin Funk <collin.funk1 <at> gmail.com>

To reply to this bug, email your comments to 79331 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#79331; Package coreutils. (Thu, 28 Aug 2025 15:06:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to yubiao hu <huyubiaox <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 28 Aug 2025 15:06:03 GMT) Full text and rfc822 format available.

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

From: yubiao hu <huyubiaox <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: [PATCH] expr: fix memory leaks
Date: Thu, 28 Aug 2025 15:51:56 +0800
fix: https://lists.gnu.org/archive/html/bug-coreutils/2025-08/msg00094.html

---
 src/expr.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/expr.c b/src/expr.c
index cd87763..534bb44 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -93,6 +93,7 @@ static VALUE *eval (bool);
 static bool nomoreargs (void);
 static bool null (VALUE *v);
 static void printv (VALUE *v);
+static void freev (VALUE *v);


 /*
@@ -307,6 +308,7 @@ int
 main (int argc, char **argv)
 {
   VALUE *v;
+  bool exit_status = true;

   initialize_main (&argc, &argv);
   set_program_name (argv[0]);
@@ -343,7 +345,11 @@ main (int argc, char **argv)

   printv (v);

-  main_exit (null (v));
+  exit_status = null (v);
+
+  freev (v);
+
+  main_exit (exit_status);
 }

 /* Return a VALUE for I.  */
-- 
2.33.0




Added tag(s) notabug. Request was from Collin Funk <collin.funk1 <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 29 Aug 2025 02:31:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 79331 <at> debbugs.gnu.org and yubiao hu <huyubiaox <at> gmail.com> Request was from Collin Funk <collin.funk1 <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 29 Aug 2025 02:31:02 GMT) Full text and rfc822 format available.

Merged 79328 79331. Request was from Collin Funk <collin.funk1 <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 29 Aug 2025 02:34:02 GMT) Full text and rfc822 format available.

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.