diff --git a/src/x509_str.c b/src/x509_str.c index ce8f0e28ea..2bd801ca1a 100644 --- a/src/x509_str.c +++ b/src/x509_str.c @@ -1879,6 +1879,11 @@ WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* wolfSSL_X509_STORE_get0_objects( wolfSSL_X509_OBJECT_free(obj); goto err_cleanup; } + if (wolfSSL_X509_up_ref(x509) != WOLFSSL_SUCCESS) { + WOLFSSL_MSG("wolfSSL_X509_up_ref error"); + wolfSSL_X509_OBJECT_free(obj); + goto err_cleanup; + } obj->type = WOLFSSL_X509_LU_X509; obj->data.x509 = x509; }