texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Fix install-info memory leak


From: Gavin D. Smith
Subject: branch master updated: Fix install-info memory leak
Date: Tue, 15 Oct 2024 17:04:36 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 0ac3d7528d Fix install-info memory leak
0ac3d7528d is described below

commit 0ac3d7528d0c38350c7e4770c31a4d282f1b120a
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Oct 15 22:04:28 2024 +0100

    Fix install-info memory leak
    
    * install-info/install-info.c (open_possibly_compressed_file):
    Move a function call returning memory that has to be freed
    to prevent a theoretical memory leak in case of an error calling
    fclose or freopen.  Report from Vitezslav Crhonek.
---
 ChangeLog                   | 9 +++++++++
 install-info/install-info.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index c93ff390a8..68da96c5cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-10-15  Gavin Smith <gavinsmith0123@gmail.com>
+
+       Fix install-info memory leak
+
+       * install-info/install-info.c (open_possibly_compressed_file):
+       Move a function call returning memory that has to be freed
+       to prevent a theoretical memory leak in case of an error calling
+       fclose or freopen.  Report from Vitezslav Crhonek.
+
 2024-10-15  Gavin Smith <gavinsmith0123@gmail.com>
 
        * README-hacking: add .git/hooks/post-commit script
diff --git a/install-info/install-info.c b/install-info/install-info.c
index adbe461442..31427526f3 100644
--- a/install-info/install-info.c
+++ b/install-info/install-info.c
@@ -825,12 +825,12 @@ determine_file_type:
     {
       /* Redirect stdin to the file and fork the decompression process
          reading from stdin.  This allows shell metacharacters in filenames. */
-      char *command = concat (*compression_program, " -d", "");
 
       if (fclose (f) < 0)
         return 0;
       if (!freopen (*opened_filename, FOPEN_RBIN, stdin))
         return 0;
+      char *command = concat (*compression_program, " -d", "");
       f = popen (command, "r");
       fclose (stdin);
       if (!f)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]