agent: Fix non-allocation for pinentry_loopback.
authorNIIBE Yutaka <gniibe@fsij.org>
Mon, 5 Oct 2015 17:05:04 +0000 (02:05 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Mon, 5 Oct 2015 22:52:32 +0000 (07:52 +0900)
* agent/call-pinentry.c (agent_get_passphrase): Don't allocate, it will
be allocated by pinentry_loopback.

agent/call-pinentry.c

index 9845a03..0140387 100644 (file)
@@ -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;