summaryrefslogtreecommitdiffhomepage
path: root/signkey.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2015-03-01 22:44:36 +0800
committerMatt Johnston <matt@ucc.asn.au>2015-03-01 22:44:36 +0800
commit3317916111c2fe05d18ff02fdde0f33cffa5d3e5 (patch)
treebdc6c8ee92a9009f9f48006beafbbf26f10d3727 /signkey.c
parent3113932151b7d2358565e41c3f81f230436126c9 (diff)
Fix some memory leaks in ecc code
Diffstat (limited to 'signkey.c')
-rw-r--r--signkey.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/signkey.c b/signkey.c
index f033e86..10a63f2 100644
--- a/signkey.c
+++ b/signkey.c
@@ -187,6 +187,7 @@ int buf_get_pub_key(buffer *buf, sign_key *key, enum signkey_type *type) {
if (eck) {
if (*eck) {
ecc_free(*eck);
+ m_free(*eck);
*eck = NULL;
}
*eck = buf_get_ecdsa_pub_key(buf);
@@ -255,6 +256,7 @@ int buf_get_priv_key(buffer *buf, sign_key *key, enum signkey_type *type) {
if (eck) {
if (*eck) {
ecc_free(*eck);
+ m_free(*eck);
*eck = NULL;
}
*eck = buf_get_ecdsa_priv_key(buf);
@@ -355,18 +357,21 @@ void sign_key_free(sign_key *key) {
#ifdef DROPBEAR_ECC_256
if (key->ecckey256) {
ecc_free(key->ecckey256);
+ m_free(key->ecckey256);
key->ecckey256 = NULL;
}
#endif
#ifdef DROPBEAR_ECC_384
if (key->ecckey384) {
ecc_free(key->ecckey384);
+ m_free(key->ecckey384);
key->ecckey384 = NULL;
}
#endif
#ifdef DROPBEAR_ECC_521
if (key->ecckey521) {
ecc_free(key->ecckey521);
+ m_free(key->ecckey521);
key->ecckey521 = NULL;
}
#endif