Check for malloc failure in r2i_certpol.

See upstream's 34b9acbd3f81b46967f692c0af49020c8c405746.

Change-Id: I88d5b3cfbbe87e883323a9e6e1bf85227ed9576e
Reviewed-on: https://boringssl-review.googlesource.com/7811
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin 2016-04-28 20:30:03 -04:00
parent 3bb5a77205
commit 176dbf04b7

View File

@ -190,6 +190,11 @@ static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,
goto err; goto err;
} }
pol = POLICYINFO_new(); pol = POLICYINFO_new();
if (pol == NULL) {
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
ASN1_OBJECT_free(pobj);
goto err;
}
pol->policyid = pobj; pol->policyid = pobj;
} }
if (!sk_POLICYINFO_push(pols, pol)) { if (!sk_POLICYINFO_push(pols, pol)) {