1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-18 14:17:03 +01:00

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@g10code.com>
This commit is contained in:
Justus Winter 2016-11-29 16:48:35 +01:00
parent 9fb5e9c145
commit 52385a2ba1

View File

@ -180,7 +180,6 @@ void
decrypt_messages (ctrl_t ctrl, int nfiles, char *files[]) decrypt_messages (ctrl_t ctrl, int nfiles, char *files[])
{ {
IOBUF fp; IOBUF fp;
armor_filter_context_t *afx = NULL;
progress_filter_context_t *pfx; progress_filter_context_t *pfx;
char *p, *output = NULL; char *p, *output = NULL;
int rc=0,use_stdin=0; int rc=0,use_stdin=0;
@ -254,8 +253,11 @@ decrypt_messages (ctrl_t ctrl, int nfiles, char *files[])
{ {
if (use_armor_filter(fp)) if (use_armor_filter(fp))
{ {
afx = new_armor_context (); armor_filter_context_t *afx = new_armor_context ();
push_armor_filter ( afx, fp ); 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); rc = proc_packets (ctrl,NULL, fp);
@ -275,6 +277,5 @@ decrypt_messages (ctrl_t ctrl, int nfiles, char *files[])
} }
set_next_passphrase(NULL); set_next_passphrase(NULL);
release_armor_context (afx);
release_progress_context (pfx); release_progress_context (pfx);
} }