forked from wolfSSL/wolfssl
Use proper ref count handling when adding to x509 store
This commit is contained in:
@@ -1408,24 +1408,30 @@ int wolfSSL_X509_STORE_add_cert(WOLFSSL_X509_STORE* store, WOLFSSL_X509* x509)
|
|||||||
result = X509StoreAddCa(store, x509, WOLFSSL_USER_CA);
|
result = X509StoreAddCa(store, x509, WOLFSSL_USER_CA);
|
||||||
#if !defined(WOLFSSL_SIGNER_DER_CERT)
|
#if !defined(WOLFSSL_SIGNER_DER_CERT)
|
||||||
if (result == WOLFSSL_SUCCESS && store->trusted != NULL) {
|
if (result == WOLFSSL_SUCCESS && store->trusted != NULL) {
|
||||||
result = wolfSSL_sk_X509_push(store->trusted, x509);
|
result = wolfSSL_X509_up_ref(x509);
|
||||||
if (result > 0) {
|
if (result == WOLFSSL_SUCCESS) {
|
||||||
result = WOLFSSL_SUCCESS;
|
result = wolfSSL_sk_X509_push(store->trusted, x509);
|
||||||
}
|
if (result > 0) {
|
||||||
else {
|
result = WOLFSSL_SUCCESS;
|
||||||
result = WOLFSSL_FATAL_ERROR;
|
}
|
||||||
|
else {
|
||||||
|
result = WOLFSSL_FATAL_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (store->certs != NULL) {
|
if (store->certs != NULL) {
|
||||||
result = wolfSSL_sk_X509_push(store->certs, x509);
|
result = wolfSSL_X509_up_ref(x509);
|
||||||
if (result > 0) {
|
if (result == WOLFSSL_SUCCESS) {
|
||||||
result = WOLFSSL_SUCCESS;
|
result = wolfSSL_sk_X509_push(store->certs, x509);
|
||||||
}
|
if (result > 0) {
|
||||||
else {
|
result = WOLFSSL_SUCCESS;
|
||||||
result = WOLFSSL_FATAL_ERROR;
|
}
|
||||||
|
else {
|
||||||
|
result = WOLFSSL_FATAL_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user