diff options
author | Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> | 2019-03-12 23:04:14 +0100 |
---|---|---|
committer | Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> | 2019-03-15 08:48:43 +0100 |
commit | 13d06925e8cb15bf4247f14280d535618e7a4b2b (patch) | |
tree | ca82800da2d050a8712465d728ad5ca4f97ab154 /crypto/trace.c | |
parent | 5afb177c3c84d36244fd1b25b96a204ae6777a51 (diff) |
trace: don't leak the line prefix
The openssl app registers trace callbacks which automatically
set a line prefix in the OSSL_TRACE_CTRL_BEGIN callback.
This prefix needs to be cleared in the OSSL_TRACE_CTRL_END
callback, otherwise a memory leak is reported when openssl
is built with crypto-mdebug enabled.
This leak causes the tests to fail when tracing and memory
debugging are enabled.
The leak can be observed by any command that produces trace
output, e.g. by
OPENSSL_TRACE=ANY util/shlib_wrap.sh apps/openssl version
...
[00:19:14] 4061 file=apps/bf_prefix.c, line=152, ...
26 bytes leaked in 1 chunks
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8463)
Diffstat (limited to 'crypto/trace.c')
-rw-r--r-- | crypto/trace.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/trace.c b/crypto/trace.c index 4e93c43def..533770c669 100644 --- a/crypto/trace.c +++ b/crypto/trace.c @@ -65,7 +65,7 @@ static int trace_write(BIO *channel, const char *buf, size_t num, size_t *written) { struct trace_data_st *ctx = BIO_get_data(channel); - size_t cnt = ctx->callback(buf, num, ctx->category, OSSL_TRACE_CTRL_DURING, + size_t cnt = ctx->callback(buf, num, ctx->category, OSSL_TRACE_CTRL_WRITE, ctx->data); *written = cnt; |