提交 227cd06f 编写于 作者: B Bodo Möller

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

"Chad C. Mulligan" <mulligan@antipope.org>.
上级 9b67b4b3
......@@ -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();
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册