Loading crypto/mem_dbg.c +9 −7 Original line number Diff line number Diff line Loading @@ -643,12 +643,12 @@ static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l) static IMPLEMENT_LHASH_DOALL_ARG_FN(print_leak, const MEM, MEM_LEAK) void CRYPTO_mem_leaks(BIO *b) int CRYPTO_mem_leaks(BIO *b) { MEM_LEAK ml; if (mh == NULL && amih == NULL) return; return 1; CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); Loading @@ -665,7 +665,6 @@ void CRYPTO_mem_leaks(BIO *b) } if (ml.chunks != 0) { BIO_printf(b, "%ld bytes leaked in %d chunks\n", ml.bytes, ml.chunks); abort(); } else { /* * Make sure that, if we found no leaks, memory-leak debugging itself Loading Loading @@ -697,15 +696,17 @@ void CRYPTO_mem_leaks(BIO *b) CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC); } CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); return ml.chunks == 0 ? 1 : 0; } # ifndef OPENSSL_NO_STDIO void CRYPTO_mem_leaks_fp(FILE *fp) int CRYPTO_mem_leaks_fp(FILE *fp) { BIO *b; int ret; if (mh == NULL) return; return 0; /* * Need to turn off memory checking when allocated BIOs ... especially as * we're creating them at a time when we're trying to check we've not Loading @@ -715,10 +716,11 @@ void CRYPTO_mem_leaks_fp(FILE *fp) b = BIO_new(BIO_s_file()); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); if (b == NULL) return; return -1; BIO_set_fp(b, fp, BIO_NOCLOSE); CRYPTO_mem_leaks(b); ret = CRYPTO_mem_leaks(b); BIO_free(b); return ret; } # endif Loading doc/crypto/OPENSSL_malloc.pod +6 −5 Original line number Diff line number Diff line Loading @@ -132,17 +132,18 @@ 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>. It will then L<abort(3)> if there were any unfree'd allocations. to the specified BIO B<b> or FILE B<fp>. These functions return 1 if there are no leaks, 0 if there are leaks and -1 if an error occurred. =head1 RETURN VALUES OPENSSL_malloc_init(), OPENSSL_free(), OPENSSL_clear_free() CRYPTO_free(), CRYPTO_clear_free(), CRYPTO_get_mem_functions(), and CRYPTO_mem_leaks() CRYPTO_free(), CRYPTO_clear_free() and CRYPTO_get_mem_functions() return no value. CRYPTO_mem_leaks() and CRYPTO_mem_leaks_fp() return 1 if there are no leaks, 0 if there are leaks and -1 if an error occurred. OPENSSL_malloc(), OPENSSL_zalloc(), OPENSSL_realloc(), OPENSSL_clear_realloc(), CRYPTO_malloc(), CRYPTO_zalloc(), CRYPTO_realloc(), Loading include/openssl/crypto.h +2 −2 Original line number Diff line number Diff line Loading @@ -509,9 +509,9 @@ void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag, void CRYPTO_mem_debug_free(void *addr, int flag); # ifndef OPENSSL_NO_STDIO void CRYPTO_mem_leaks_fp(FILE *); int CRYPTO_mem_leaks_fp(FILE *); # endif void CRYPTO_mem_leaks(struct bio_st *bio); int CRYPTO_mem_leaks(struct bio_st *bio); # endif /* die if we have to */ Loading Loading
crypto/mem_dbg.c +9 −7 Original line number Diff line number Diff line Loading @@ -643,12 +643,12 @@ static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l) static IMPLEMENT_LHASH_DOALL_ARG_FN(print_leak, const MEM, MEM_LEAK) void CRYPTO_mem_leaks(BIO *b) int CRYPTO_mem_leaks(BIO *b) { MEM_LEAK ml; if (mh == NULL && amih == NULL) return; return 1; CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); Loading @@ -665,7 +665,6 @@ void CRYPTO_mem_leaks(BIO *b) } if (ml.chunks != 0) { BIO_printf(b, "%ld bytes leaked in %d chunks\n", ml.bytes, ml.chunks); abort(); } else { /* * Make sure that, if we found no leaks, memory-leak debugging itself Loading Loading @@ -697,15 +696,17 @@ void CRYPTO_mem_leaks(BIO *b) CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC); } CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); return ml.chunks == 0 ? 1 : 0; } # ifndef OPENSSL_NO_STDIO void CRYPTO_mem_leaks_fp(FILE *fp) int CRYPTO_mem_leaks_fp(FILE *fp) { BIO *b; int ret; if (mh == NULL) return; return 0; /* * Need to turn off memory checking when allocated BIOs ... especially as * we're creating them at a time when we're trying to check we've not Loading @@ -715,10 +716,11 @@ void CRYPTO_mem_leaks_fp(FILE *fp) b = BIO_new(BIO_s_file()); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); if (b == NULL) return; return -1; BIO_set_fp(b, fp, BIO_NOCLOSE); CRYPTO_mem_leaks(b); ret = CRYPTO_mem_leaks(b); BIO_free(b); return ret; } # endif Loading
doc/crypto/OPENSSL_malloc.pod +6 −5 Original line number Diff line number Diff line Loading @@ -132,17 +132,18 @@ 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>. It will then L<abort(3)> if there were any unfree'd allocations. to the specified BIO B<b> or FILE B<fp>. These functions return 1 if there are no leaks, 0 if there are leaks and -1 if an error occurred. =head1 RETURN VALUES OPENSSL_malloc_init(), OPENSSL_free(), OPENSSL_clear_free() CRYPTO_free(), CRYPTO_clear_free(), CRYPTO_get_mem_functions(), and CRYPTO_mem_leaks() CRYPTO_free(), CRYPTO_clear_free() and CRYPTO_get_mem_functions() return no value. CRYPTO_mem_leaks() and CRYPTO_mem_leaks_fp() return 1 if there are no leaks, 0 if there are leaks and -1 if an error occurred. OPENSSL_malloc(), OPENSSL_zalloc(), OPENSSL_realloc(), OPENSSL_clear_realloc(), CRYPTO_malloc(), CRYPTO_zalloc(), CRYPTO_realloc(), Loading
include/openssl/crypto.h +2 −2 Original line number Diff line number Diff line Loading @@ -509,9 +509,9 @@ void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag, void CRYPTO_mem_debug_free(void *addr, int flag); # ifndef OPENSSL_NO_STDIO void CRYPTO_mem_leaks_fp(FILE *); int CRYPTO_mem_leaks_fp(FILE *); # endif void CRYPTO_mem_leaks(struct bio_st *bio); int CRYPTO_mem_leaks(struct bio_st *bio); # endif /* die if we have to */ Loading