Mercurial > dropbear
diff signkey.c @ 1381:c98e242dc505 fuzz
add m_mp_free_multi, be more careful freeing when failing to load keys
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 26 May 2017 21:08:43 +0800 |
parents | 616417b27f55 |
children | 798854f62430 |
line wrap: on
line diff
--- a/signkey.c Fri May 26 00:20:01 2017 +0800 +++ b/signkey.c Fri May 26 21:08:43 2017 +0800 @@ -168,7 +168,8 @@ key->dsskey = m_malloc(sizeof(*key->dsskey)); ret = buf_get_dss_pub_key(buf, key->dsskey); if (ret == DROPBEAR_FAILURE) { - m_free(key->dsskey); + dss_key_free(key->dsskey); + key->dsskey = NULL; } } #endif @@ -178,7 +179,8 @@ key->rsakey = m_malloc(sizeof(*key->rsakey)); ret = buf_get_rsa_pub_key(buf, key->rsakey); if (ret == DROPBEAR_FAILURE) { - m_free(key->rsakey); + rsa_key_free(key->rsakey); + key->rsakey = NULL; } } #endif @@ -202,7 +204,6 @@ TRACE2(("leave buf_get_pub_key")) return ret; - } /* returns DROPBEAR_SUCCESS on success, DROPBEAR_FAILURE on fail. @@ -237,7 +238,8 @@ key->dsskey = m_malloc(sizeof(*key->dsskey)); ret = buf_get_dss_priv_key(buf, key->dsskey); if (ret == DROPBEAR_FAILURE) { - m_free(key->dsskey); + dss_key_free(key->dsskey); + key->dsskey = NULL; } } #endif @@ -247,7 +249,8 @@ key->rsakey = m_malloc(sizeof(*key->rsakey)); ret = buf_get_rsa_priv_key(buf, key->rsakey); if (ret == DROPBEAR_FAILURE) { - m_free(key->rsakey); + rsa_key_free(key->rsakey); + key->rsakey = NULL; } } #endif