]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix memory leak in library deinit
authorEmilia Kasper <emilia@openssl.org>
Sat, 12 Mar 2016 19:46:13 +0000 (20:46 +0100)
committerEmilia Kasper <emilia@openssl.org>
Sat, 12 Mar 2016 20:47:01 +0000 (21:47 +0100)
commit8cab4e9bc73a66b64aae179db86493fd28c39b64
tree89ff4afb8865dbc6426ee7f6197b8328d01a2cdb
parent36cc1390f265ce5f07a8841c106a6e1e7e021678
Fix memory leak in library deinit

ENGINE_cleanup calls CRYPTO_free_ex_data and therefore,
CRYPTO_cleanup_all_ex_data - which cleans up the method pointers - must
run after ENGINE_cleanup.

Additionally, don't needlessly initialize the EX_CALLBACKS stack during
e.g. CRYPTO_free_ex_data. The only time this is actually needed is when
reserving the first ex data index. Specifically, since sk_num returns -1
on NULL input, the rest of the code already handles a NULL method stack
correctly.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/ex_data.c
crypto/init.c