trace: don't leak the line prefix
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Tue, 12 Mar 2019 22:04:14 +0000 (23:04 +0100)
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Fri, 15 Mar 2019 07:48:43 +0000 (08:48 +0100)
commit13d06925e8cb15bf4247f14280d535618e7a4b2b
treeca82800da2d050a8712465d728ad5ca4f97ab154
parent5afb177c3c84d36244fd1b25b96a204ae6777a51
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)
apps/openssl.c
crypto/trace.c
include/openssl/trace.h