Fix free of garbage pointer. PR#3595
Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit e04d426bf98ebb22abf0f15b6f09d333a6e8b2ad)
This commit is contained in:
parent
9e5267fcdd
commit
db85611989
@ -446,14 +446,15 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
|
|||||||
wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */
|
wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */
|
||||||
val_sub = OPENSSL_malloc(totalnum * sizeof val_sub[0]);
|
val_sub = OPENSSL_malloc(totalnum * sizeof val_sub[0]);
|
||||||
|
|
||||||
|
/* Ensure wNAF is initialised in case we end up going to err */
|
||||||
|
if (wNAF) wNAF[0] = NULL; /* preliminary pivot */
|
||||||
|
|
||||||
if (!wsize || !wNAF_len || !wNAF || !val_sub)
|
if (!wsize || !wNAF_len || !wNAF || !val_sub)
|
||||||
{
|
{
|
||||||
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
|
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
wNAF[0] = NULL; /* preliminary pivot */
|
|
||||||
|
|
||||||
/* num_val will be the total number of temporarily precomputed points */
|
/* num_val will be the total number of temporarily precomputed points */
|
||||||
num_val = 0;
|
num_val = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user