diff options
author | Nikos Mavrogiannopoulos <nmav@turtle.(none)> | 2008-09-28 03:34:59 +0300 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@turtle.(none)> | 2008-09-28 03:34:59 +0300 |
commit | 699aa57dacc6446e92c123e93bba1f894067893e (patch) | |
tree | 06bdeb26502e3f5e109fcac7464763876e576f10 /lib | |
parent | 2e607973d6fa03fa7630822355757700cefc0856 (diff) | |
download | gnutls-699aa57dacc6446e92c123e93bba1f894067893e.tar.gz |
more memory leak fixes (based on patch by Sam)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/auth_cert.c | 2 | ||||
-rw-r--r-- | lib/gnutls_constate.c | 31 |
2 files changed, 9 insertions, 24 deletions
diff --git a/lib/auth_cert.c b/lib/auth_cert.c index b964c459df..a1000f1fa5 100644 --- a/lib/auth_cert.c +++ b/lib/auth_cert.c @@ -73,6 +73,8 @@ _gnutls_copy_certificate_auth_info (cert_auth_info_t info, if (info->raw_certificate_list != NULL) { + for (j = 0; j < info->ncerts; j++) + _gnutls_free_datum (&info->raw_certificate_list[j]); gnutls_free( info->raw_certificate_list); } diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c index 5252643b5c..e8db441c15 100644 --- a/lib/gnutls_constate.c +++ b/lib/gnutls_constate.c @@ -114,16 +114,17 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, _gnutls_bin2hex (key_block, block_size, buf, sizeof (buf))); + _gnutls_free_datum (&session->cipher_specs.server_write_mac_secret); + _gnutls_free_datum (&session->cipher_specs.client_write_mac_secret); + _gnutls_free_datum (&session->cipher_specs.server_write_IV); + _gnutls_free_datum (&session->cipher_specs.client_write_IV); + _gnutls_free_datum (&session->cipher_specs.server_write_key); + _gnutls_free_datum (&session->cipher_specs.client_write_key); + pos = 0; if (hash_size > 0) { - if (session->cipher_specs.client_write_mac_secret.data != NULL) - _gnutls_free_datum(&session->cipher_specs.client_write_mac_secret); - - if (session->cipher_specs.server_write_mac_secret.data != NULL) - _gnutls_free_datum(&session->cipher_specs.server_write_mac_secret); - if (_gnutls_sset_datum (&session->cipher_specs.client_write_mac_secret, &key_block[pos], hash_size) < 0) @@ -226,9 +227,6 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, pos += key_size; } - if (session->cipher_specs.client_write_key.data != NULL) - _gnutls_free_datum(&session->cipher_specs.client_write_key); - if (_gnutls_sset_datum (&session->cipher_specs.client_write_key, client_write_key, client_write_key_size) < 0) @@ -242,9 +240,6 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, client_write_key_size, buf, sizeof (buf))); - if (session->cipher_specs.server_write_key.data != NULL) - _gnutls_free_datum(&session->cipher_specs.server_write_key); - if (_gnutls_sset_datum (&session->cipher_specs.server_write_key, server_write_key, server_write_key_size) < 0) @@ -266,9 +261,6 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, */ if (IV_size > 0 && export_flag == 0) { - if (session->cipher_specs.client_write_IV.data != NULL) - _gnutls_free_datum(&session->cipher_specs.client_write_IV); - if (_gnutls_sset_datum (&session->cipher_specs.client_write_IV, &key_block[pos], IV_size) < 0) @@ -278,9 +270,6 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, } pos += IV_size; - if (session->cipher_specs.server_write_IV.data != NULL) - _gnutls_free_datum(&session->cipher_specs.server_write_IV); - if (_gnutls_sset_datum (&session->cipher_specs.server_write_IV, &key_block[pos], IV_size) < 0) @@ -325,9 +314,6 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, return ret; } - if (session->cipher_specs.client_write_IV.data != NULL) - _gnutls_free_datum(&session->cipher_specs.client_write_IV); - if (_gnutls_sset_datum (&session->cipher_specs.client_write_IV, iv_block, IV_size) < 0) { @@ -335,9 +321,6 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, return GNUTLS_E_MEMORY_ERROR; } - if (session->cipher_specs.server_write_IV.data != NULL) - _gnutls_free_datum(&session->cipher_specs.server_write_IV); - if (_gnutls_sset_datum (&session->cipher_specs.server_write_IV, &iv_block[IV_size], IV_size) < 0) |