Fix cleanup in crypto_tester if AEAD implementation fails
authorTobias Brunner <tobias@strongswan.org>
Tue, 12 Feb 2013 15:42:45 +0000 (16:42 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 28 Feb 2013 17:17:42 +0000 (18:17 +0100)
src/libstrongswan/crypto/crypto_tester.c

index 08b2264..12db096 100644 (file)
@@ -451,7 +451,10 @@ METHOD(crypto_tester_t, test_aead, bool,
 failure:
                aead->destroy(aead);
                chunk_free(&cipher);
-               chunk_free(&plain);
+               if (plain.ptr != vector->plain)
+               {
+                       chunk_free(&plain);
+               }
                if (failed)
                {
                        DBG1(DBG_LIB, "disabled %N[%s]: %s test vector failed",