diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2018-03-02 09:27:39 +0100 |
---|---|---|
committer | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2018-03-03 19:58:18 +0100 |
commit | 55a7f77d72930f9aee1a51e0af9658b2728be127 (patch) | |
tree | ca8a40e46533b9049f8a1b5e7c6b632ea7c076be /crypto/engine/eng_table.c | |
parent | c03dc6427cb8d15ddce735b5e5beef606bdea51d (diff) |
Fix a possible memory leak in engine_table_register
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5489)
Diffstat (limited to 'crypto/engine/eng_table.c')
-rw-r--r-- | crypto/engine/eng_table.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/engine/eng_table.c b/crypto/engine/eng_table.c index 219253a38a..ffdecb9991 100644 --- a/crypto/engine/eng_table.c +++ b/crypto/engine/eng_table.c @@ -109,6 +109,11 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup, } fnd->funct = NULL; (void)lh_ENGINE_PILE_insert(&(*table)->piles, fnd); + if (lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate) != fnd) { + sk_ENGINE_free(fnd->sk); + OPENSSL_free(fnd); + goto end; + } } /* A registration shouldn't add duplicate entries */ (void)sk_ENGINE_delete_ptr(fnd->sk, e); |