[Pkg-gnupg-commit] [gnupg2] 34/180: g10: Fix memory leak.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Dec 24 22:29:05 UTC 2016


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

dkg pushed a commit to branch master
in repository gnupg2.

commit 52385a2ba1bf7e53f500ffde5fd34f28e69cf76b
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 29 16:48:35 2016 +0100

    g10: Fix memory leak.
    
    * g10/decrypt.c (decrypt_messages): Properly decrease the reference
    count of the armor filters after pushing them.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 g10/decrypt.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/g10/decrypt.c b/g10/decrypt.c
index 751b7be..c99f064 100644
--- a/g10/decrypt.c
+++ b/g10/decrypt.c
@@ -180,7 +180,6 @@ void
 decrypt_messages (ctrl_t ctrl, int nfiles, char *files[])
 {
   IOBUF fp;
-  armor_filter_context_t *afx = NULL;
   progress_filter_context_t *pfx;
   char *p, *output = NULL;
   int rc=0,use_stdin=0;
@@ -254,8 +253,11 @@ decrypt_messages (ctrl_t ctrl, int nfiles, char *files[])
         {
           if (use_armor_filter(fp))
             {
-              afx = new_armor_context ();
-              push_armor_filter ( afx, fp );
+              armor_filter_context_t *afx = new_armor_context ();
+              rc = push_armor_filter (afx, fp);
+              if (rc)
+                log_error("failed to push armor filter");
+              release_armor_context (afx);
             }
         }
       rc = proc_packets (ctrl,NULL, fp);
@@ -275,6 +277,5 @@ decrypt_messages (ctrl_t ctrl, int nfiles, char *files[])
     }
 
   set_next_passphrase(NULL);
-  release_armor_context (afx);
   release_progress_context (pfx);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list