Skip to content

Commit 101088c

Browse files
author
Andras Fekete
committed
Fix potential NULL dereference
1 parent 3a83c33 commit 101088c

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/ocsp.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,13 +824,16 @@ WOLFSSL_OCSP_CERTID* wolfSSL_OCSP_cert_to_id(
824824
if (ret != 0) {
825825
if (derCert != NULL)
826826
FreeDer(&derCert);
827-
XFREE(certId, cm->heap, DYNAMIC_TYPE_OPENSSL);
828-
certId = NULL;
829-
XFREE(certStatus, cm->heap, DYNAMIC_TYPE_OPENSSL);
827+
if (cm != NULL) {
828+
XFREE(certId, cm->heap, DYNAMIC_TYPE_OPENSSL);
829+
certId = NULL;
830+
XFREE(certStatus, cm->heap, DYNAMIC_TYPE_OPENSSL);
831+
}
830832
}
831833

832834
#ifdef WOLFSSL_SMALL_STACK
833-
XFREE(cert, cm->heap, DYNAMIC_TYPE_DCERT);
835+
if (cm != NULL)
836+
XFREE(cert, cm->heap, DYNAMIC_TYPE_DCERT);
834837
#endif
835838

836839
if (cm != NULL)

0 commit comments

Comments
 (0)