fix resource cleanup in testsuite and wolfcrypt test

This commit is contained in:
Chris Conlon
2015-10-09 10:57:55 -06:00
parent 9f6b07aec2
commit 7e5be2f313
4 changed files with 6 additions and 2 deletions

View File

@ -2577,7 +2577,7 @@ ProtocolVersion MakeDTLSv1_2(void)
word32 LowResTimer(void)
{
NET_SECURE_OS_TICK clk;
NET_SECURE_OS_TICK clk = 0;
#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
clk = NetSecure_OS_TimeGet();

View File

@ -382,6 +382,7 @@ void file_test(const char* file, byte* check)
ret = wc_Sha256Update(&sha256, buf, i);
if (ret != 0) {
printf("Can't wc_Sha256Update %d\n", ret);
fclose(f);
return;
}
}
@ -389,6 +390,7 @@ void file_test(const char* file, byte* check)
ret = wc_Sha256Final(&sha256, shasum);
if (ret != 0) {
printf("Can't wc_Sha256Final %d\n", ret);
fclose(f);
return;
}

View File

@ -4447,6 +4447,7 @@ int rsa_test(void)
free(derCert);
free(pem);
free(tmp);
fclose(pemFile);
wc_FreeRsaKey(&caKey);
return -415;
}

View File

@ -918,7 +918,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
sz = ftell(file);
rewind(file);
fread(buff, sizeof(buff), 1, file);
if (type == WOLFSSL_CA) {
if (wolfSSL_CTX_load_verify_buffer(ctx, buff, sz, SSL_FILETYPE_PEM)
!= SSL_SUCCESS)
@ -934,6 +934,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
SSL_FILETYPE_PEM) != SSL_SUCCESS)
err_sys("can't load buffer key file");
}
fclose(file);
}
#endif /* NO_FILESYSTEM */