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>

Full log


View this message in rfc822 format

From: yubiao hu <huyubiaox <at> gmail.com>
To: 79331 <at> debbugs.gnu.org
Subject: bug#79331: [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




This bug report was last modified 13 days ago.

Previous Next


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