Don't leak memory from ERR_add_error_vdata()
authorMatt Caswell <matt@openssl.org>
Mon, 28 Jan 2019 17:17:59 +0000 (17:17 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 29 Jan 2019 11:12:26 +0000 (11:12 +0000)
commit9ed9875f0599babfb34bc52c17455765dfc0ac42
treef10994705d77904ff0e05ee6991c2d2069cbbc87
parent6b4f989233c7eb22e40106cc77e3007eb223bf4c
Don't leak memory from ERR_add_error_vdata()

If the call the ERR_set_error_data() in ERR_add_error_vdata() fails then
a mem leak can occur. This commit checks that we successfully added the
error data, and if not frees the buffer.

Fixes #8085

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/8105)

(cherry picked from commit fa6b1ee1115c1e5e3a8286d833dcbaa2c1ce2b77)
crypto/err/err.c