tls: Fix a memory leak if AEAD encryption fails
authorMartin Willi <martin@revosec.ch>
Wed, 15 Oct 2014 12:20:36 +0000 (14:20 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 15 Oct 2014 12:21:01 +0000 (14:21 +0200)
src/libtls/tls_aead.c

index 1d0779d..67cfd3a 100644 (file)
@@ -82,6 +82,7 @@ METHOD(tls_aead_t, encrypt, bool,
        assoc = chunk_from_thing(hdr);
        if (!this->aead->encrypt(this->aead, plain, assoc, iv, NULL))
        {
+               chunk_free(&encrypted);
                return FALSE;
        }
        chunk_free(data);