diff options
author | Kevin Butler <haqkrs@gmail.com> | 2013-09-04 02:56:06 +0100 |
---|---|---|
committer | Kevin Butler <haqkrs@gmail.com> | 2013-09-04 02:56:06 +0100 |
commit | b539b372058613b94ef31073de6595ac5d882fd1 (patch) | |
tree | e5dc10476b69f7eecfec1257a15a4b2dc3fa75bb /src/common | |
parent | 6e17fa6d7ba57b990dd929e07969d35dc82fc46b (diff) | |
download | tor-b539b372058613b94ef31073de6595ac5d882fd1.tar tor-b539b372058613b94ef31073de6595ac5d882fd1.tar.gz |
Fixed leak and added minor documentation for #6384.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/crypto.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 5be3327b8..c83a562fe 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -195,6 +195,9 @@ try_load_engine(const char *path, const char *engine) } #endif +/* Returns a trimmed and human-readable version of an openssl version string +* <b>raw_version</b>. They are usually in the form of 'OpenSSL 1.0.0b 10 +* May 2012' and this will parse them into a form similar to '1.0.0b' */ static char * parse_openssl_version_str(const char *raw_version) { @@ -225,13 +228,17 @@ crypto_openssl_get_version_str(void) return crypto_openssl_version_str; } +static char *crypto_openssl_header_version_str = NULL; /* Return a human-readable version of the compile-time openssl version * number. */ const char * crypto_openssl_get_header_version_str(void) { - //return OPENSSL_VERSION_TEXT; - return parse_openssl_version_str(OPENSSL_VERSION_TEXT); + if (crypto_openssl_header_version_str == NULL) { + crypto_openssl_header_version_str = + parse_openssl_version_str(OPENSSL_VERSION_TEXT); + } + return crypto_openssl_header_version_str; } /** Initialize the crypto library. Return 0 on success, -1 on failure. @@ -3114,6 +3121,7 @@ crypto_global_cleanup(void) } #endif tor_free(crypto_openssl_version_str); + tor_free(crypto_openssl_header_version_str); return 0; } |