Commit e04d426b authored by Matt Caswell's avatar Matt Caswell
Browse files

Fix free of garbage pointer. PR#3595

parent 67b8bcee
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -448,14 +448,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 */
	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)
		{
		ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
		goto err;
		}

	wNAF[0] = NULL;	/* preliminary pivot */

	/* num_val will be the total number of temporarily precomputed points */
	num_val = 0;