Commit 227cd06f authored by Bodo Möller's avatar Bodo Möller
Browse files

Avoid some memory holes, one of which was pointed out by

"Chad C. Mulligan" <mulligan@antipope.org>.
parent 9b67b4b3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ int main(int Argc, char *Argv[])
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);

	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);

	ERR_load_crypto_strings();

+1 −0
Original line number Diff line number Diff line
@@ -326,6 +326,7 @@ err:
	if (ok == -1) DSAerr(DSA_F_DSA_IS_PRIME,ERR_R_BN_LIB);
	BN_CTX_free(ctx);
	BN_CTX_free(ctx2);
	BN_MONT_CTX_free(mont);
	
	return(ok);
	}
+2 −0
Original line number Diff line number Diff line
@@ -125,6 +125,8 @@ err:
	if (ctx != NULL) BN_CTX_free(ctx);
	BN_clear_free(&m);
	BN_clear_free(&xr);
	if (kinv != NULL) /* dsa->kinv is NULL now if we used it */
	    BN_clear_free(kinv);
	return(ret);
	}

+4 −1
Original line number Diff line number Diff line
@@ -134,6 +134,8 @@ int main(int argc, char **argv)
	if (bio_err == NULL)
		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);

	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);

	BIO_printf(bio_err,"test generation of DSA parameters\n");
	BIO_printf(bio_err,"expect '.*' followed by 5 lines of '.'s and '+'s\n");
	dsa=DSA_generate_parameters(512,seed,20,&counter,&h,dsa_cb,
@@ -190,8 +192,9 @@ int main(int argc, char **argv)
end:
	if (!ret)
		ERR_print_errors(bio_err);
	if (bio_err != NULL) BIO_free(bio_err);
	if (dsa != NULL) DSA_free(dsa);
	CRYPTO_mem_leaks(bio_err);
	if (bio_err != NULL) BIO_free(bio_err);
	exit(!ret);
	return(0);
	}