summaryrefslogtreecommitdiffstats
path: root/crypto/engine
diff options
context:
space:
mode:
authorPavel Kopyl <p.kopyl@samsung.com>2017-11-03 18:18:59 +0300
committerRichard Levitte <levitte@openssl.org>2018-05-02 08:35:32 +0200
commitaebd0e5ca12d1ba0b229a4121a54afa5ea2d8aa1 (patch)
treeb9fca98d10a2a71395910ef190652f41e16701aa /crypto/engine
parentc4fa1f7fc016919a5b3d4ea2aa66c77e0cc40c9d (diff)
Fix memory leaks in CA related functions.
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4700)
Diffstat (limited to 'crypto/engine')
-rw-r--r--crypto/engine/eng_lib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c
index 95736eda6a..9028319788 100644
--- a/crypto/engine/eng_lib.c
+++ b/crypto/engine/eng_lib.c
@@ -154,8 +154,10 @@ void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb)
if (!int_cleanup_check(1))
return;
item = int_cleanup_item(cb);
- if (item)
- sk_ENGINE_CLEANUP_ITEM_push(cleanup_stack, item);
+ if (item != NULL) {
+ if (sk_ENGINE_CLEANUP_ITEM_push(cleanup_stack, item) <= 0)
+ OPENSSL_free(item);
+ }
}
/* The API function that performs all cleanup */