ASN.1: Introduce helper function to free ASN.1 sequence
diff --git a/library/asn1parse.c b/library/asn1parse.c
index e7e4d13..3105d32 100644
--- a/library/asn1parse.c
+++ b/library/asn1parse.c
@@ -269,7 +269,16 @@
return( 0 );
}
-
+void mbedtls_asn1_sequence_free( mbedtls_asn1_sequence *seq )
+{
+ while( seq != NULL )
+ {
+ mbedtls_asn1_sequence *next = seq->next;
+ mbedtls_platform_zeroize( seq, sizeof( *seq ) );
+ mbedtls_free( seq );
+ seq = next;
+ }
+}
/*
* Parses and splits an ASN.1 "SEQUENCE OF <tag>"