Merge pull request #7805 from julek-wolfssl/wolfSSL_X509_REQ_add1_attr_by_NID-push-cleanup

wolfSSL_X509_REQ_add1_attr_by_NID: clean up push call for analyzers
pull/7823/head
David Garske 2024-07-31 13:16:30 -07:00 committed by GitHub
commit 54997837f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -14510,11 +14510,12 @@ int wolfSSL_X509_REQ_add1_attr_by_NID(WOLFSSL_X509 *req,
req->reqAttributes->type = STACK_TYPE_X509_REQ_ATTR;
}
}
ret = wolfSSL_sk_push(req->reqAttributes, attr);
if ((ret != WOLFSSL_SUCCESS) || (req->reqAttributes->type == STACK_TYPE_CIPHER)) {
/* CIPHER type makes a copy */
if (req->reqAttributes->type == STACK_TYPE_X509_REQ_ATTR)
ret = wolfSSL_sk_push(req->reqAttributes, attr);
else
ret = WOLFSSL_FAILURE;
if (ret != WOLFSSL_SUCCESS)
wolfSSL_X509_ATTRIBUTE_free(attr);
}
}
return ret;