Skip to content

Commit a284373

Browse files
rschu1zeKonstantin Bogdanov
authored andcommitted
Suppress leaksan false positive
1 parent 1ff0194 commit a284373

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

crypto/engine/eng_lib.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
#include <openssl/rand.h>
1313
#include "internal/refcount.h"
1414

15+
#if defined(__has_feature)
16+
# if __has_feature(address_sanitizer)
17+
#include <sanitizer/lsan_interface.h>
18+
# endif
19+
#endif
20+
1521
CRYPTO_RWLOCK *global_engine_lock;
1622

1723
CRYPTO_ONCE engine_lock_init = CRYPTO_ONCE_STATIC_INIT;
@@ -33,8 +39,18 @@ ENGINE *ENGINE_new(void)
3339
ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB);
3440
return 0;
3541
}
42+
#if defined(__has_feature)
43+
# if __has_feature(address_sanitizer)
44+
__lsan_disable();
45+
# endif
46+
#endif
3647
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
3748
return NULL;
49+
#if defined(__has_feature)
50+
# if __has_feature(address_sanitizer)
51+
__lsan_enable();
52+
# endif
53+
#endif
3854
if (!CRYPTO_NEW_REF(&ret->struct_ref, 1)) {
3955
OPENSSL_free(ret);
4056
return NULL;

0 commit comments

Comments
 (0)