Avoid using a dangling pointer when removing the last item
authorKurt Roeckx <kurt@roeckx.be>
Tue, 22 Dec 2015 12:11:59 +0000 (13:11 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Wed, 23 Dec 2015 19:36:32 +0000 (20:36 +0100)
commit933d10851640014142db0f3b02c2b740c2f0935f
treee941e1b9491b76ac36b02063a11210b8a72eabb7
parentc849c6d9d3bf806fecfe0c16eaa55d361979ff7f
Avoid using a dangling pointer when removing the last item

When it's the last item that is removed int_thread_hash == hash and we would
still call int_thread_release(&hash) while hash is already freed.  So
int_thread_release would compare that dangling pointer to NULL which is
undefined behaviour.  Instead do already what int_thread_release() would do,
and make the call do nothing instead.

Reviewed-by: Rich Salz <rsalz@openssl.org>
RT: #4155, MR: #1519
crypto/err/err.c