summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cipher/ecc-ecdh.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/cipher/ecc-ecdh.c b/cipher/ecc-ecdh.c
index 615b108d..39458788 100644
--- a/cipher/ecc-ecdh.c
+++ b/cipher/ecc-ecdh.c
@@ -112,8 +112,11 @@ _gcry_ecc_mul_point (int algo, unsigned char *result,
buf = _gcry_mpi_get_buffer (x, nbytes, &len, NULL);
if (!buf)
err = gpg_error_from_syserror ();
- memcpy (result, buf, nbytes);
- xfree (buf);
+ else
+ {
+ memcpy (result, buf, nbytes);
+ xfree (buf);
+ }
leave:
_gcry_mpi_release (x);