aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/credentials/keys
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-08-27 13:58:48 +0200
committerMartin Willi <martin@strongswan.org>2009-08-27 13:59:30 +0200
commited75a4dd69bf0521c664729601489b182f91e579 (patch)
tree8a49bf9b5be240ab42051da10d2b342d483fc014 /src/libstrongswan/credentials/keys
parent85fd609ed646d0691841180e21ac6dec398efc12 (diff)
downloadstrongswan-ed75a4dd69bf0521c664729601489b182f91e579.tar.bz2
strongswan-ed75a4dd69bf0521c664729601489b182f91e579.tar.xz
do not flush cached encodings, keys are responsible for it
Diffstat (limited to 'src/libstrongswan/credentials/keys')
-rw-r--r--src/libstrongswan/credentials/keys/key_encoding.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/libstrongswan/credentials/keys/key_encoding.c b/src/libstrongswan/credentials/keys/key_encoding.c
index 1e6201603..601ce2a53 100644
--- a/src/libstrongswan/credentials/keys/key_encoding.c
+++ b/src/libstrongswan/credentials/keys/key_encoding.c
@@ -256,20 +256,14 @@ static void remove_encoder(private_key_encoding_t *this, key_encoder_t encoder)
*/
static void destroy(private_key_encoding_t *this)
{
- enumerator_t *enumerator;
key_encoding_type_t type;
- chunk_t *chunk;
- void *key;
for (type = 0; type < KEY_ENCODING_MAX; type++)
{
- enumerator = this->cache[type]->create_enumerator(this->cache[type]);
- while (enumerator->enumerate(enumerator, &key, &chunk))
- {
- chunk_free(chunk);
- free(chunk);
- }
- enumerator->destroy(enumerator);
+ /* We explicitly do not free remaining encodings. All keys should
+ * have gone now, and they are responsible for cleaning out their
+ * cache entries. Not flushing here allows the leak detective to
+ * complain if a key did not flush cached encodings. */
this->cache[type]->destroy(this->cache[type]);
}
this->encoders->destroy(this->encoders);