mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
test/testutil/init.c, apps/openssl.c: add trace cleanup handle earlier
It turned out that the internal trace cleanup handler was added too late, so it would be executed before OPENSSL_cleanup(). This results in address errors, as the trace code that's executed in OPENSSL_cleanup() itself tries to reach for data that's been freed at that point. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9196)
This commit is contained in:
parent
7a5f5fd32a
commit
ba4341316c
@ -216,6 +216,13 @@ static void setup_trace(const char *str)
|
||||
{
|
||||
char *val;
|
||||
|
||||
/*
|
||||
* We add this handler as early as possible to ensure it's executed
|
||||
* as late as possible, i.e. after the TRACE code has done its cleanup
|
||||
* (which happens last in OPENSSL_cleanup).
|
||||
*/
|
||||
atexit(cleanup_trace);
|
||||
|
||||
trace_data_stack = sk_tracedata_new_null();
|
||||
val = OPENSSL_strdup(str);
|
||||
|
||||
@ -240,7 +247,6 @@ static void setup_trace(const char *str)
|
||||
}
|
||||
|
||||
OPENSSL_free(val);
|
||||
atexit(cleanup_trace);
|
||||
}
|
||||
#endif /* OPENSSL_NO_TRACE */
|
||||
|
||||
|
@ -102,6 +102,13 @@ static void setup_trace(const char *str)
|
||||
{
|
||||
char *val;
|
||||
|
||||
/*
|
||||
* We add this handler as early as possible to ensure it's executed
|
||||
* as late as possible, i.e. after the TRACE code has done its cleanup
|
||||
* (which happens last in OPENSSL_cleanup).
|
||||
*/
|
||||
atexit(cleanup_trace);
|
||||
|
||||
trace_data_stack = sk_tracedata_new_null();
|
||||
val = OPENSSL_strdup(str);
|
||||
|
||||
@ -126,7 +133,6 @@ static void setup_trace(const char *str)
|
||||
}
|
||||
|
||||
OPENSSL_free(val);
|
||||
atexit(cleanup_trace);
|
||||
}
|
||||
#endif /* OPENSSL_NO_TRACE */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user