diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2006-03-28 17:23:48 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2006-03-28 17:23:48 +0000 |
commit | 246e09319c1d2a8140ffe1e5aeb1be26015696f0 (patch) | |
tree | 4cf7e9633d8849983bd6a7803fb49c7f64f01a1d /crypto/objects | |
parent | f7a3296d8c8746b9901e95674425f300a6dfd1d4 (diff) |
Fix bug where freed OIDs could be accessed in EVP_cleanup() by
defering freeing in OBJ_cleanup().
Diffstat (limited to 'crypto/objects')
-rw-r--r-- | crypto/objects/obj_dat.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 7a95c7795a..aca492d1df 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -208,8 +208,26 @@ static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ *) static IMPLEMENT_LHASH_DOALL_FN(cleanup2, ADDED_OBJ *) static IMPLEMENT_LHASH_DOALL_FN(cleanup3, ADDED_OBJ *) +/* The purpose of obj_cleanup_defer is to avoid EVP_cleanup() attempting + * to use freed up OIDs. If neccessary the actual freeing up of OIDs is + * delayed. + */ + +int obj_cleanup_defer = 0; + +void check_defer(int nid) + { + if (obj_cleanup_defer && nid >= NUM_NID) + obj_cleanup_defer = 1; + } + void OBJ_cleanup(void) { + if (obj_cleanup_defer) + { + obj_cleanup_defer = 2; + return ; + } if (added == NULL) return; added->down_load=0; lh_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */ |