summaryrefslogtreecommitdiffstats
path: root/crypto/engine
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2018-03-02 09:27:39 +0100
committerBernd Edlinger <bernd.edlinger@hotmail.de>2018-03-03 20:00:18 +0100
commitda25dc2985a93ffade1f3467b496eb53577a1f8c (patch)
tree20ddfcbb73b432294c6b83b8c449b670be9e7a0a /crypto/engine
parent00cd974f46f8d61896fdf3ca2b238f88e5b9216f (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) (cherry picked from commit 55a7f77d72930f9aee1a51e0af9658b2728be127)
Diffstat (limited to 'crypto/engine')
-rw-r--r--crypto/engine/eng_table.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/engine/eng_table.c b/crypto/engine/eng_table.c
index 27d31f70c8..5049fd679e 100644
--- a/crypto/engine/eng_table.c
+++ b/crypto/engine/eng_table.c
@@ -159,6 +159,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 duplciate entries */
(void)sk_ENGINE_delete_ptr(fnd->sk, e);