From d8b73f2312a2b5bff26210f4de82c0de573d8d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 16 Oct 2018 10:34:13 +0200 Subject: [PATCH] Remove unnecessary calls to init() from free() Our API makes no guarantee that you can use a context after free()ing it without re-init()ing it first, so better not give the wrong impression that we do, while it's not policy and the rest of the code might not allow it. --- library/ecdh.c | 2 -- library/ecdsa.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/library/ecdh.c b/library/ecdh.c index 8336912808..fb46845c90 100644 --- a/library/ecdh.c +++ b/library/ecdh.c @@ -161,8 +161,6 @@ void mbedtls_ecdh_free( mbedtls_ecdh_context *ctx ) #if defined(MBEDTLS_ECP_RESTARTABLE) mbedtls_ecp_restart_free( &ctx->rs ); #endif - - mbedtls_ecdh_init( ctx ); } #if defined(MBEDTLS_ECP_RESTARTABLE) diff --git a/library/ecdsa.c b/library/ecdsa.c index 663433c907..9e35da1f78 100644 --- a/library/ecdsa.c +++ b/library/ecdsa.c @@ -126,8 +126,6 @@ static void ecdsa_restart_sig_free( mbedtls_ecdsa_restart_sig_ctx *ctx ) mbedtls_mpi_free( &ctx->k ); mbedtls_mpi_free( &ctx->r ); - - ecdsa_restart_sig_init( ctx ); } #if defined(MBEDTLS_ECDSA_DETERMINISTIC)