Fixes #12531 on master branch.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12557)
if ((dest->algorithm = OBJ_dup(src->algorithm)) == NULL)
return 0;
- if (src->parameter)
+ if (src->parameter != NULL) {
+ dest->parameter = ASN1_TYPE_new();
+ if (dest->parameter == NULL)
+ return 0;
+
/* Assuming this is also correct for a BOOL.
* set does copy as a side effect.
*/
if (ASN1_TYPE_set1(dest->parameter,
src->parameter->type, src->parameter->value.ptr) == 0)
return 0;
+ }
return 1;
}
default:
CMSerr(CMS_F_CMS_DATAINIT, CMS_R_UNSUPPORTED_TYPE);
- return NULL;
+ goto err;
}
if (cmsbio)
return BIO_push(cmsbio, cont);
-
+err:
if (!icont)
BIO_free(cont);
return NULL;
id = NULL;
ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
+ ASN1_OBJECT_free(id);
X509V3err(X509V3_F_POLICY_DATA_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}