From 236ea16c011d356266b32ef7ae817c0f2573563e Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Wed, 12 Dec 2018 14:00:34 +0000 Subject: [PATCH] Fix wrong conditional in free() functions --- library/chachapoly.c | 2 +- library/poly1305.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/chachapoly.c b/library/chachapoly.c index e6ea139ff..dc643dd61 100644 --- a/library/chachapoly.c +++ b/library/chachapoly.c @@ -108,7 +108,7 @@ void mbedtls_chachapoly_init( mbedtls_chachapoly_context *ctx ) void mbedtls_chachapoly_free( mbedtls_chachapoly_context *ctx ) { - if( ctx != NULL ) + if( ctx == NULL ) return; mbedtls_chacha20_free( &ctx->chacha20_ctx ); diff --git a/library/poly1305.c b/library/poly1305.c index c22a0a1ba..b27411918 100644 --- a/library/poly1305.c +++ b/library/poly1305.c @@ -289,7 +289,7 @@ void mbedtls_poly1305_init( mbedtls_poly1305_context *ctx ) void mbedtls_poly1305_free( mbedtls_poly1305_context *ctx ) { - if( ctx != NULL ) + if( ctx == NULL ) return; mbedtls_platform_zeroize( ctx, sizeof( mbedtls_poly1305_context ) );