diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2001-06-21 12:19:10 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2001-06-21 12:19:10 +0000 |
commit | ed5538dc2bf723388aba3aea332bf554c514dcfe (patch) | |
tree | 641425173d9370ae2dd48910c4b2098f18508de4 /crypto/rand | |
parent | b8ffcf49edc15d60714963b268ce4b28c45e382a (diff) |
Fix memory leak when RAND is used: need to cleanup
RANDs ENGINE reference in ENGINE_cleanup().
Diffstat (limited to 'crypto/rand')
-rw-r--r-- | crypto/rand/rand_lib.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 38cea79938..adbae32ce3 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -74,11 +74,12 @@ int RAND_set_rand_method(ENGINE *engine) { ENGINE *mtmp; mtmp = rand_engine; - if (!ENGINE_init(engine)) + if (engine && !ENGINE_init(engine)) return 0; rand_engine = engine; /* SHOULD ERROR CHECK THIS!!! */ - ENGINE_finish(mtmp); + if(mtmp) + ENGINE_finish(mtmp); return 1; } #endif |