Fix possible memory leak

This commit is contained in:
Andras Fekete
2023-10-24 17:47:31 -04:00
parent 21d465cf9a
commit 2877b7be50

View File

@ -14098,7 +14098,8 @@ int wolfSSL_X509_REQ_add1_attr_by_NID(WOLFSSL_X509 *req,
}
}
ret = wolfSSL_sk_push(req->reqAttributes, attr);
if (ret != WOLFSSL_SUCCESS) {
if ((ret != WOLFSSL_SUCCESS) || (req->reqAttributes->type == STACK_TYPE_CIPHER)) {
/* CIPHER type makes a copy */
wolfSSL_X509_ATTRIBUTE_free(attr);
}
}