Add a missing check of the return code of X509_ALGOR_set0.
otherwise a memory leak may occur.
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22999)
(cherry picked from commit
493d6c9ab37b18b110c977a2bc896f06b18f6065)
*palg = X509_ALGOR_new();
if (*palg == NULL)
goto err;
- X509_ALGOR_set0(*palg, OBJ_nid2obj(NID_mgf1), V_ASN1_SEQUENCE, stmp);
+ if (!X509_ALGOR_set0(*palg, OBJ_nid2obj(NID_mgf1), V_ASN1_SEQUENCE, stmp)) {
+ X509_ALGOR_free(*palg);
+ *palg = NULL;
+ goto err;
+ }
stmp = NULL;
err:
ASN1_STRING_free(stmp);