Skip to content

Commit 4bb6c51

Browse files
committed
Fix -4 return code when expected BAD_FUNC_ARG(-173)
1 parent 2c4556c commit 4bb6c51

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/ssl_certman.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,11 @@ int wolfSSL_CertManagerVerify(WOLFSSL_CERT_MANAGER* cm, const char* fname,
819819
WOLFSSL_MSG("Getting dynamic buffer");
820820
buff = (byte*)XMALLOC((size_t)sz, cm->heap, DYNAMIC_TYPE_FILE);
821821
if (buff == NULL) {
822-
ret = WOLFSSL_BAD_FILE;
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+
}
823827
}
824828
}
825829
/* Read all the file into buffer. */

0 commit comments

Comments
 (0)