Fix a mem leak in CMS
authorMatt Caswell <matt@openssl.org>
Tue, 1 May 2018 08:29:17 +0000 (09:29 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 8 May 2018 07:43:39 +0000 (08:43 +0100)
commit3d551b20df1acd01f80d3ae00d37177e0fdf344a
treed480b063cc81fd3d432ef4c69a0f8ab49b049cf7
parent4ffc1842fa7da63b42da0e9553ebee33e2e173aa
Fix a mem leak in CMS

The function CMS_RecipientInfo_set0_pkey() is a "set0" and therefore
memory management passes to OpenSSL. If the same function is called again
then we should ensure that any previous value that was set is freed first
before we set it again.

Fixes #5052

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6142)
crypto/cms/cms_env.c
crypto/cms/cms_smime.c