[git] GPG-ERROR - branch, master, updated. libgpg-error-1.27-6-g1e72035

by NIIBE Yutaka cvs at cvs.gnupg.org
Tue May 30 13:47:41 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Error codes used by GnuPG et al.".

The branch, master has been updated
       via  1e7203515be0b030709109e9da621642dfa20312 (commit)
      from  a8d267a7220399f7acf69723fe1d31efd2160319 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1e7203515be0b030709109e9da621642dfa20312
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Tue May 30 20:46:12 2017 +0900

    Fix memory leak for estream.
    
    * src/estream.c (do_list_remove): Free the item.
    (do_close): Free the buffer.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/src/estream.c b/src/estream.c
index 066fe02..cae0a69 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -459,17 +459,30 @@ do_list_add (estream_t stream, int with_locked_list)
 static void
 do_list_remove (estream_t stream, int with_locked_list)
 {
-  estream_list_t item;
+  estream_list_t item, item_prev = NULL;
 
   if (!with_locked_list)
     lock_list ();
 
   for (item = estream_list; item; item = item->next)
     if (item->stream == stream)
-      {
-        item->stream = NULL;
-        break;
-      }
+      break;
+    else
+      item_prev = item;
+
+  if (item_prev)
+    {
+      item_prev->next = item->next;
+      mem_free (item);
+    }
+  else
+    {
+      if (item)
+        {
+          estream_list = item->next;
+          mem_free (item);
+        }
+    }
 
   if (!with_locked_list)
     unlock_list ();
@@ -2233,6 +2246,8 @@ do_close (estream_t stream, int with_locked_list)
         }
       err = deinit_stream_obj (stream);
       destroy_stream_lock (stream);
+      if (stream->intern->deallocate_buffer)
+        mem_free (stream->buffer);
       mem_free (stream->intern);
       mem_free (stream);
     }

-----------------------------------------------------------------------

Summary of changes:
 src/estream.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Error codes used by GnuPG et al.
http://git.gnupg.org




More information about the Gnupg-commits mailing list