texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Gavin D. Smith
Date: Wed, 16 Oct 2024 16:46:43 -0400 (EDT)

branch: master
commit b947f466144401ff11d3dd36ccceeccee5dbab13
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Wed Oct 16 21:40:04 2024 +0100

    * install-info/install-info.c (readfile): re-order code
    to prevent possible memory leak.  Report from Vitezslav Crhonek.
---
 ChangeLog                   | 5 +++++
 install-info/install-info.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index c09f264d96..e34421bbfe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-16  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * install-info/install-info.c (readfile): re-order code
+       to prevent possible memory leak.  Report from Vitezslav Crhonek.
+
 2024-10-16  Vitezslav Crhonek  <vcrhonek@redhat.com>
 
        * install-info/install-info.c (munge_old_style_debian_options):
diff --git a/install-info/install-info.c b/install-info/install-info.c
index 902e9845e5..2edec85849 100644
--- a/install-info/install-info.c
+++ b/install-info/install-info.c
@@ -875,7 +875,6 @@ readfile (char *filename, int *sizep,
   FILE *f;
   int filled = 0;
   int data_size = 8192;
-  char *data = xmalloc (data_size + 1);
 
   /* If they passed the space for the file name to return, use it.  */
   f = open_possibly_compressed_file (filename, create_callback,
@@ -885,6 +884,8 @@ readfile (char *filename, int *sizep,
   if (!f)
     return 0;
 
+  char *data = xmalloc (data_size + 1);
+
   for (;;)
     {
       int nread = fread (data + filled, 1, data_size - filled, f);



reply via email to

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