From ce2a84b58833fd308d5fe11756721f39c953280a Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 6 Oct 2015 02:05:04 +0900 Subject: [PATCH] agent: Fix non-allocation for pinentry_loopback. * agent/call-pinentry.c (agent_get_passphrase): Don't allocate, it will be allocated by pinentry_loopback. --- agent/call-pinentry.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index 9845a0358..0140387fd 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -1063,12 +1063,10 @@ agent_get_passphrase (ctrl_t ctrl, { size_t size; size_t len = ASSUAN_LINELENGTH/2; - unsigned char *buffer = gcry_malloc_secure (len); + unsigned char *buffer; rc = pinentry_loopback(ctrl, "PASSPHRASE", &buffer, &size, len); - if (rc) - xfree(buffer); - else + if (!rc) { buffer[size] = 0; *retpass = buffer;