mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Fix missing initializations on some error paths
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@ -68,6 +68,7 @@ static int pk_write_any_key(mbedtls_pk_context *pk, unsigned char **p,
|
||||
static void pk_write_check_common(char *key_file, int is_public_key, int is_der)
|
||||
{
|
||||
mbedtls_pk_context key;
|
||||
mbedtls_pk_init(&key);
|
||||
unsigned char *buf = NULL;
|
||||
unsigned char *check_buf = NULL;
|
||||
unsigned char *start_buf;
|
||||
@ -78,9 +79,6 @@ static void pk_write_check_common(char *key_file, int is_public_key, int is_der)
|
||||
|
||||
USE_PSA_INIT();
|
||||
|
||||
mbedtls_pk_init(&key);
|
||||
USE_PSA_INIT();
|
||||
|
||||
/* Note: if mbedtls_pk_load_file() successfully reads the file, then
|
||||
it also allocates check_buf, which should be freed on exit */
|
||||
TEST_EQUAL(mbedtls_pk_load_file(key_file, &check_buf, &check_buf_len), 0);
|
||||
|
Reference in New Issue
Block a user