From 1e9445503c3ea65f8c138ab5dc555db0f1db91a7 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 14 Apr 2018 07:18:37 +0000 Subject: Make ENGINE_free() succeed on NULL. Matches OpenSSL's behavior and simplifies the caller side. tested by & ok inoguchi; discussed with schwarze --- src/regress/lib/libcrypto/engine/enginetest.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/regress/lib/libcrypto/engine') diff --git a/src/regress/lib/libcrypto/engine/enginetest.c b/src/regress/lib/libcrypto/engine/enginetest.c index bb2472a31d..f39857d6d6 100644 --- a/src/regress/lib/libcrypto/engine/enginetest.c +++ b/src/regress/lib/libcrypto/engine/enginetest.c @@ -129,8 +129,7 @@ int main(int argc, char *argv[]) printf("Remove failed!\n"); goto end; } - if (ptr) - ENGINE_free(ptr); + ENGINE_free(ptr); display_engine_list(); if (!ENGINE_add(new_h3) || !ENGINE_add(new_h2)) { printf("Add failed!\n"); @@ -178,8 +177,7 @@ int main(int argc, char *argv[]) if (!ENGINE_remove(ptr)) printf("Remove failed!i - probably no hardware " "support present.\n"); - if (ptr) - ENGINE_free(ptr); + ENGINE_free(ptr); display_engine_list(); if (!ENGINE_add(new_h1) || !ENGINE_remove(new_h1)) { @@ -231,13 +229,12 @@ int main(int argc, char *argv[]) end: if (to_return) ERR_print_errors_fp(stderr); - if (new_h1) ENGINE_free(new_h1); - if (new_h2) ENGINE_free(new_h2); - if (new_h3) ENGINE_free(new_h3); - if (new_h4) ENGINE_free(new_h4); + ENGINE_free(new_h1); + ENGINE_free(new_h2); + ENGINE_free(new_h3); + ENGINE_free(new_h4); for (loop = 0; loop < 512; loop++) - if (block[loop]) - ENGINE_free(block[loop]); + ENGINE_free(block[loop]); ENGINE_cleanup(); CRYPTO_cleanup_all_ex_data(); ERR_free_strings(); -- cgit v1.2.3-55-g6feb