Skip to content

Commit 9806f5a

Browse files
authored
Merge pull request libgit2#5999 from libgit2/ethomson/openssl_valgrind
openssl: don't fail when we can't customize allocators
2 parents 3f02b5b + 1903cfe commit 9806f5a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/streams/openssl.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,18 @@ int git_openssl_stream_global_init(void)
251251
#endif
252252

253253
#ifdef VALGRIND
254-
/* Swap in our own allocator functions that initialize allocated memory */
255-
if (!allocators_initialized &&
254+
/*
255+
* Swap in our own allocator functions that initialize
256+
* allocated memory to avoid spurious valgrind warnings.
257+
* Don't error on failure; many builds of OpenSSL do not
258+
* allow you to set these functions.
259+
*/
260+
if (!allocators_initialized) {
256261
CRYPTO_set_mem_functions(git_openssl_malloc,
257262
git_openssl_realloc,
258-
git_openssl_free) != 1)
259-
goto error;
260-
allocators_initialized = true;
263+
git_openssl_free);
264+
allocators_initialized = true;
265+
}
261266
#endif
262267

263268
OPENSSL_init_ssl(0, NULL);

0 commit comments

Comments
 (0)