diff options
author | Richard Levitte <levitte@openssl.org> | 2002-11-19 13:23:29 +0300 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2002-11-19 13:23:29 +0300 |
commit | b0fc31b390b1e189e8b86a66f3e46b0de1bd3d58 (patch) | |
tree | 619c0125a8ff5432a7c1317917a845a295177042 /crypto/mem_dbg.c | |
parent | 6ceffdd121df9391f30b75e67d07db8607b5d825 (diff) |
Recent changes from 0.9.6-stable.
Diffstat (limited to 'crypto/mem_dbg.c')
-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 ef19d8f844..5d3547790f 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; @@ -496,9 +510,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); } |