diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-11-08 22:02:30 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-11-09 08:49:12 +0100 |
commit | 395d620849722bd7fef44cb540a6bb435694d626 (patch) | |
tree | 1d26d5f9f5b39963af62b825b2a5e46e2ca2749a /lib/nettle | |
parent | 8462e62e31fd8244ecf8c47cd7b6084837b9da17 (diff) | |
download | gnutls-395d620849722bd7fef44cb540a6bb435694d626.tar.gz |
release allocated memory on a cipher or mac failure to initialize.
Diffstat (limited to 'lib/nettle')
-rw-r--r-- | lib/nettle/cipher.c | 1 | ||||
-rw-r--r-- | lib/nettle/mac.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/nettle/cipher.c b/lib/nettle/cipher.c index 014a54924c..83da47379a 100644 --- a/lib/nettle/cipher.c +++ b/lib/nettle/cipher.c @@ -182,6 +182,7 @@ wrap_nettle_cipher_init (gnutls_cipher_algorithm_t algo, void **_ctx, int enc) break; default: gnutls_assert (); + gnutls_free(ctx); return GNUTLS_E_INVALID_REQUEST; } diff --git a/lib/nettle/mac.c b/lib/nettle/mac.c index a0f4ea56a7..4a77895a27 100644 --- a/lib/nettle/mac.c +++ b/lib/nettle/mac.c @@ -177,7 +177,10 @@ wrap_nettle_hmac_init (gnutls_mac_algorithm_t algo, void **_ctx) ret = _hmac_ctx_init(algo, ctx); if (ret < 0) - return gnutls_assert_val(ret); + { + gnutls_free(ctx); + return gnutls_assert_val(ret); + } *_ctx = ctx; @@ -372,6 +375,7 @@ wrap_nettle_hash_init (gnutls_digest_algorithm_t algo, void **_ctx) if ((ret=_ctx_init( algo, ctx)) < 0) { gnutls_assert (); + gnutls_free(ctx); return ret; } |