From: Richard Levitte Date: Mon, 1 Oct 2001 17:15:28 +0000 (+0000) Subject: sk_ENGINE_CLEANUP_ITEM_pop_free() is duplicated in ENGINE_cleanup(). X-Git-Tag: OpenSSL_0_9_6c~26^2~162 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=1cf9d58cb4ca8dfe6a504357866bd710bebba806 sk_ENGINE_CLEANUP_ITEM_pop_free() is duplicated in ENGINE_cleanup(). Let's use sk_ENGINE_CLEANUP_ITEM_pop_free() instead. --- diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c index 86f5ec7847..d29258c04e 100644 --- a/crypto/engine/eng_lib.c +++ b/crypto/engine/eng_lib.c @@ -157,19 +157,17 @@ void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb) sk_ENGINE_CLEANUP_ITEM_push(cleanup_stack, item); } /* The API function that performs all cleanup */ +static void engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item) + { + (*(item->cb))(); + OPENSSL_free(cb); + } void ENGINE_cleanup(void) { if(int_cleanup_check(0)) { - int loop = 0, num = sk_ENGINE_CLEANUP_ITEM_num(cleanup_stack); - while(loop < num) - { - ENGINE_CLEANUP_ITEM *item = sk_ENGINE_CLEANUP_ITEM_value( - cleanup_stack, loop++); - (*(item->cb))(); - OPENSSL_free(item); - } - sk_ENGINE_CLEANUP_ITEM_free(cleanup_stack); + sk_ENGINE_CLEANUP_ITEM_pop_free(cleanup_stack, + engine_cleanup_cb_free); cleanup_stack = NULL; } /* FIXME: This should be handled (somehow) through RAND, eg. by it