commit | 1f19fa6f62346d57d5dac41512cc107c8a7fc7fb | [log] [tgz] |
---|---|---|
author | Gilles Peskine <Gilles.Peskine@arm.com> | Wed Dec 19 14:18:39 2018 +0100 |
committer | Gilles Peskine <Gilles.Peskine@arm.com> | Wed Dec 19 14:18:39 2018 +0100 |
tree | ad4ea1092e8a1115999e7a834f937b1cfe7a23cb | |
parent | e146e7dbaeceaa62b3d8258f2433819c2dfc32ca [diff] |
PK: Fix free(NULL) in library and tests free() functions are documented as no-ops on NULL. Implement and test this correctly.
diff --git a/library/pk.c b/library/pk.c index d8bce8f..38ab774 100644 --- a/library/pk.c +++ b/library/pk.c
@@ -90,8 +90,7 @@ */ void mbedtls_pk_restart_free( mbedtls_pk_restart_ctx *ctx ) { - PK_VALIDATE( ctx != NULL ); - if( ctx->pk_info == NULL || + if( ctx == NULL || ctx->pk_info == NULL || ctx->pk_info->rs_free_func == NULL ) { return;