summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-08-21 08:27:59 -0400
committerGitHub <noreply@github.com>2021-08-21 08:27:59 -0400
commit9806f5ac2c930f372f589a2498e13bff8b37aa87 (patch)
tree6fceb2c7b0facbad988f4512ae407fe0f20a192d
parent3f02b5b95e90d6be25aedf3f861e173182e815d7 (diff)
parent1903cfef0b318c861bd29f03c783815b1349cf6d (diff)
downloadlibgit2-9806f5ac2c930f372f589a2498e13bff8b37aa87.tar.gz
Merge pull request #5999 from libgit2/ethomson/openssl_valgrind
openssl: don't fail when we can't customize allocators
-rw-r--r--src/streams/openssl.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/streams/openssl.c b/src/streams/openssl.c
index d866832c6..01ce9ce2a 100644
--- a/src/streams/openssl.c
+++ b/src/streams/openssl.c
@@ -251,13 +251,18 @@ int git_openssl_stream_global_init(void)
#endif
#ifdef VALGRIND
- /* Swap in our own allocator functions that initialize allocated memory */
- if (!allocators_initialized &&
+ /*
+ * Swap in our own allocator functions that initialize
+ * allocated memory to avoid spurious valgrind warnings.
+ * Don't error on failure; many builds of OpenSSL do not
+ * allow you to set these functions.
+ */
+ if (!allocators_initialized) {
CRYPTO_set_mem_functions(git_openssl_malloc,
git_openssl_realloc,
- git_openssl_free) != 1)
- goto error;
- allocators_initialized = true;
+ git_openssl_free);
+ allocators_initialized = true;
+ }
#endif
OPENSSL_init_ssl(0, NULL);