Add 'exit' label and variable initialization to relevant test suite functions
diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function
index 3afdff6..2bc1ef9 100644
--- a/tests/suites/test_suite_cipher.function
+++ b/tests/suites/test_suite_cipher.function
@@ -207,6 +207,7 @@
/*
* Done
*/
+exit:
cipher_free( &ctx_dec );
cipher_free( &ctx_enc );
}
@@ -259,6 +260,7 @@
TEST_ASSERT( ret == cipher_finish( &ctx, encbuf + outlen, &outlen ) );
/* done */
+exit:
cipher_free( &ctx );
}
/* END_CASE */
@@ -308,6 +310,7 @@
&ctx_dec, decbuf + outlen, &outlen ) );
TEST_ASSERT( 0 == outlen );
+exit:
cipher_free( &ctx_dec );
}
/* END_CASE */
@@ -397,6 +400,7 @@
TEST_ASSERT( 0 == memcmp(inbuf, decbuf, length) );
+exit:
cipher_free( &ctx_dec );
cipher_free( &ctx_enc );
}
@@ -479,6 +483,7 @@
TEST_ASSERT( 0 == memcmp( output, clear, clear_len ) );
}
+exit:
cipher_free( &ctx );
}
/* END_CASE */
@@ -536,7 +541,7 @@
if( strcmp( hex_clear, "FAIL" ) == 0 )
{
TEST_ASSERT( ret == POLARSSL_ERR_CIPHER_AUTH_FAILED );
- goto cleanup;
+ goto exit;
}
/* otherwise, make sure it was decrypted properly */
@@ -566,7 +571,7 @@
TEST_ASSERT( my_tag[tag_len + 1] == 0xFF );
-cleanup:
+exit:
cipher_free( &ctx );
}
/* END_CASE */
@@ -616,6 +621,7 @@
TEST_ASSERT( 0 == memcmp( output, result,
cipher_get_block_size( &ctx ) ) );
+exit:
cipher_free( &ctx );
}
/* END_CASE */
@@ -634,6 +640,7 @@
TEST_ASSERT( ret == cipher_set_padding_mode( &ctx, pad_mode ) );
+exit:
cipher_free( &ctx );
}
/* END_CASE */