Skip to content

Commit e51399c

Browse files
committed
Do the success checkout out front
1 parent 4bb6c51 commit e51399c

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/ssl_certman.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ int wolfSSL_CertManagerVerify(WOLFSSL_CERT_MANAGER* cm, const char* fname,
782782
#ifndef WOLFSSL_SMALL_STACK
783783
byte staticBuffer[FILE_BUFFER_SIZE];
784784
#endif
785-
byte* buff;
785+
byte* buff = NULL;
786786
long sz = 0;
787787
XFILE file = XBADFILE;
788788

@@ -814,16 +814,15 @@ int wolfSSL_CertManagerVerify(WOLFSSL_CERT_MANAGER* cm, const char* fname,
814814
* small. */
815815
#ifndef WOLFSSL_SMALL_STACK
816816
if ((ret == WOLFSSL_SUCCESS) && (sz > (long)sizeof(staticBuffer)))
817+
#else
818+
819+
if (ret == WOLFSSL_SUCCESS)
817820
#endif
818821
{
819822
WOLFSSL_MSG("Getting dynamic buffer");
820823
buff = (byte*)XMALLOC((size_t)sz, cm->heap, DYNAMIC_TYPE_FILE);
821824
if (buff == NULL) {
822-
/* If some other error has already occurred preserve that code
823-
* return WOLFSSL_BAD_FILE if that is the only error condition */
824-
if (ret == WOLFSSL_SUCCESS) {
825-
ret = WOLFSSL_BAD_FILE;
826-
}
825+
ret = WOLFSSL_BAD_FILE;
827826
}
828827
}
829828
/* Read all the file into buffer. */

0 commit comments

Comments
 (0)