Enable/disable crypto-mdebug just like other features
Also always abort() on leak failure. Reviewed-by: Stephen Henson <steve@openssl.org>
This commit is contained in:
committed by
Dr. Stephen Henson
parent
3af45d9978
commit
c2e27310c7
@@ -56,7 +56,7 @@ CRYPTO_mem_leaks, CRYPTO_mem_leaks_fp - Memory allocation functions
|
||||
#define CRYPTO_MEM_CHECK_DISABLE
|
||||
#define CRYPTO_MEM_CHECK_ENABLE
|
||||
|
||||
int CRYPTO_mem_ctrl(int flags);
|
||||
int CRYPTO_mem_ctrl(int mode);
|
||||
|
||||
int OPENSSL_mem_debug_push(const char *info)
|
||||
int OPENSLS_mem_debug_pop)(void)
|
||||
@@ -112,12 +112,14 @@ This is most useful for identifying memory leaks.
|
||||
CRYPTO_set_mem_debug() turns this tracking on and off. It is normally
|
||||
called at startup, but can be called at any time.
|
||||
|
||||
Finer-grain control of the tracking can be done with CRYPTO_mem_ctrl().
|
||||
The most common case is to enable tracking, which is done by using
|
||||
the B<CRYPTO_MEM_CHECK_ON> constant; it can be turned off by using
|
||||
the B<CRYPTO_MEM_CHECK_OFF> value. The disable and enable values are
|
||||
most commonly used within OpenSSL to termporarily suspend and restore
|
||||
tracking of library internals.
|
||||
CRYPTO_mem_ctrl() provides fine-grained control of memory leak tracking.
|
||||
To enable tracking call CRYPTO_mem_ctrl() with a B<mode> argument of
|
||||
the B<CRYPTO_MEM_CHECK_ON>.
|
||||
To disable tracking call CRYPTO_mem_ctrl() with a B<mode> argument of
|
||||
the B<CRYPTO_MEM_CHECK_OFF>.
|
||||
The B<CRYPTO_MEM_CHECK_DISABLE> and B<CRYPTO_MEM_CHECK_ENABLE> modes
|
||||
are used internally within OpenSSL to temporarily suspend and resume
|
||||
tracking.
|
||||
|
||||
While checking memory, it can be useful to store additional context
|
||||
about what is being done.
|
||||
@@ -129,11 +131,9 @@ This must be a global or other static string; it is not copied.
|
||||
OPENSSL_mem_debug_pop() removes identifying state from the stack.
|
||||
|
||||
At the end of the program, calling CRYPTO_mem_leaks() or
|
||||
CRYPTO_mem_leaks_fp() will
|
||||
report all "leaked" memory, writing it to the specified BIO B<b>
|
||||
or FILE B<fp>.
|
||||
Depending on how OpenSSL is built, it may then abort if there
|
||||
are any unfree'd allocations, for debugging.
|
||||
CRYPTO_mem_leaks_fp() will report all "leaked" memory, writing it
|
||||
to the specified BIO B<b> or FILE B<fp>.
|
||||
It will then L<abort(3)> if there were any unfree'd allocations.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
@@ -154,7 +154,7 @@ CRYPTO_set_mem_functions() and CRYPTO_set_mem_debug()
|
||||
return 1 on success or 0 on failure (almost
|
||||
always because allocations have already happened).
|
||||
|
||||
CRYPTO_mem_ctrl() return the previous value of the flag.
|
||||
CRYPTO_mem_ctrl() returns the previous value of the mode.
|
||||
|
||||
OPENSSL_mem_debug_push() and OPENSSL_mem_debug_pop()
|
||||
return 1 on success or 0 on failure.
|
||||
|
||||
Reference in New Issue
Block a user