summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2015-10-05 19:05:04 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2015-10-06 00:52:32 +0200
commitce2a84b58833fd308d5fe11756721f39c953280a (patch)
tree9df890ff0f6252a6c08b415db6d48e7ff97c2176
parentgpg: Install a dirmngr.conf file. (diff)
downloadgnupg2-ce2a84b58833fd308d5fe11756721f39c953280a.tar.xz
gnupg2-ce2a84b58833fd308d5fe11756721f39c953280a.zip
agent: Fix non-allocation for pinentry_loopback.
* agent/call-pinentry.c (agent_get_passphrase): Don't allocate, it will be allocated by pinentry_loopback.
-rw-r--r--agent/call-pinentry.c6
1 files 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;