diff options
author | Bodo Möller <bodo@openssl.org> | 1999-07-19 14:36:10 +0400 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 1999-07-19 14:36:10 +0400 |
commit | e391116a48c42c6fdb28a307f8be3558e5c06b63 (patch) | |
tree | 1cecc1d7478b87262d6caa7b78e2ca1efff0ccb1 /crypto/mem.c | |
parent | 458cddc1042eb91c5bb1e2bffd8fcfe5ee960d4d (diff) |
New compile time option -DCRYPTO_MDEBUG_THREAD.
Diffstat (limited to 'crypto/mem.c')
-rw-r--r-- | crypto/mem.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/crypto/mem.c b/crypto/mem.c index 77df806298..61fc1e184e 100644 --- a/crypto/mem.c +++ b/crypto/mem.c @@ -92,6 +92,9 @@ typedef struct mem_st int num; const char *file; int line; +#ifdef CRYPTO_MDEBUG_THREAD + unsigned long thread; +#endif unsigned long order; #ifdef CRYPTO_MDEBUG_TIME time_t time; @@ -239,6 +242,9 @@ void *CRYPTO_dbg_malloc(int num, const char *file, int line) m->file=file; m->line=line; m->num=num; +#ifdef CRYPTO_MDEBUG_THREAD + m->thread=CRYPTO_thread_id(); +#endif if (order == break_order_num) { /* BREAK HERE */ @@ -329,20 +335,35 @@ typedef struct mem_leak_st static void print_leak(MEM *m, MEM_LEAK *l) { char buf[128]; +#ifdef CRYPTO_MDEBUG_TIME + struct tm *lcl; +#endif if(m->addr == (char *)l->bio) return; + +#ifdef CRYPTO_MDEBUG_TIME + lcl = localtime(&m->time); +#endif + + sprintf(buf, +#ifdef CRYPTO_MDEBUG_TIME + "[%02d:%02d:%02d] " +#endif + "%5lu file=%s, line=%d, " +#ifdef CRYPTO_MDEBUG_THREAD + "thread=%lu, " +#endif + "number=%d, address=%08lX\n", #ifdef CRYPTO_MDEBUG_TIME - { - struct tm *lcl = localtime(&m->time); - sprintf(buf,"[%02d:%02d:%02d] %5lu file=%s, line=%d, number=%d, address=%08lX\n", lcl->tm_hour,lcl->tm_min,lcl->tm_sec, - m->order,m->file,m->line,m->num,(unsigned long)m->addr); - } -#else - sprintf(buf,"%5lu file=%s, line=%d, number=%d, address=%08lX\n", - m->order,m->file,m->line,m->num,(unsigned long)m->addr); #endif + m->order,m->file,m->line, +#ifdef CRYPTO_MDEBUG_THREAD + m->thread, +#endif + m->num,(unsigned long)m->addr); + BIO_puts(l->bio,buf); l->chunks++; l->bytes+=m->num; |