summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh_ameth.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dh/dh_ameth.c')
-rw-r--r--src/lib/libcrypto/dh/dh_ameth.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/libcrypto/dh/dh_ameth.c b/src/lib/libcrypto/dh/dh_ameth.c
index 91178a92b0..729c996a1b 100644
--- a/src/lib/libcrypto/dh/dh_ameth.c
+++ b/src/lib/libcrypto/dh/dh_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_ameth.c,v 1.11 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: dh_ameth.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -120,8 +120,7 @@ dh_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
120err: 120err:
121 if (public_key) 121 if (public_key)
122 ASN1_INTEGER_free(public_key); 122 ASN1_INTEGER_free(public_key);
123 if (dh) 123 DH_free(dh);
124 DH_free(dh);
125 return 0; 124 return 0;
126} 125}
127 126
@@ -409,14 +408,12 @@ dh_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
409 408
410 if ((a = BN_dup(from->pkey.dh->p)) == NULL) 409 if ((a = BN_dup(from->pkey.dh->p)) == NULL)
411 return 0; 410 return 0;
412 if (to->pkey.dh->p != NULL) 411 BN_free(to->pkey.dh->p);
413 BN_free(to->pkey.dh->p);
414 to->pkey.dh->p = a; 412 to->pkey.dh->p = a;
415 413
416 if ((a = BN_dup(from->pkey.dh->g)) == NULL) 414 if ((a = BN_dup(from->pkey.dh->g)) == NULL)
417 return 0; 415 return 0;
418 if (to->pkey.dh->g != NULL) 416 BN_free(to->pkey.dh->g);
419 BN_free(to->pkey.dh->g);
420 to->pkey.dh->g = a; 417 to->pkey.dh->g = a;
421 418
422 return 1; 419 return 1;