diff options
author | Bodo Möller <bodo@openssl.org> | 2002-11-18 14:00:42 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-11-18 14:00:42 +0000 |
commit | 9dc610495cb70d9e9566a188853860c542221d86 (patch) | |
tree | e8a79e8395701a34499f8fc9112a478dd9964ea3 /crypto | |
parent | 055076cd4f53849996d90cce60f5ab681b1ba0a6 (diff) | |
download | openssl-9dc610495cb70d9e9566a188853860c542221d86.tar.gz |
fix memory leak in memory debuggin code ...
Submitted by: Nils Larsch
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/mem_dbg.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c index 0c1855afb1..57bd08f65d 100644 --- a/crypto/mem_dbg.c +++ b/crypto/mem_dbg.c @@ -102,6 +102,8 @@ typedef struct app_mem_info_st int references; } APP_INFO; +static void app_info_free(APP_INFO *); + static LHASH *amih=NULL; /* hash-table with those app_mem_info_st's * that are at the top of their thread's stack * (with `thread' as key); @@ -140,6 +142,18 @@ static unsigned long disabling_thread = 0; /* Valid iff num_disable > 0. * thread named in disabling_thread). */ +static void app_info_free(APP_INFO *inf) + { + if (--(inf->references) <= 0) + { + if (inf->next != NULL) + { + app_info_free(inf->next); + } + OPENSSL_free(inf); + } + } + int CRYPTO_mem_ctrl(int mode) { int ret=mh_mode; @@ -502,9 +516,7 @@ void CRYPTO_dbg_free(void *addr, int before_p) mp->order, mp->addr, mp->num); #endif if (mp->app_info != NULL) - { - mp->app_info->references--; - } + app_info_free(mp->app_info); OPENSSL_free(mp); } |