提交 024d681e 编写于 作者: T Todd Short 提交者: Rich Salz

Skipping tests in evp_test leaks memory

When configured with "no-mdc2 enable-crypto-mdebug" the evp_test
will leak memory due to skipped tests, and error out.

Also fix a skip condition
Reviewed-by: NRichard Levitte <levitte@openssl.org>
Reviewed-by: NRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1968)
上级 beacb0f0
...@@ -351,25 +351,28 @@ static int setup_test(struct evp_test *t, const struct evp_test_method *tmeth) ...@@ -351,25 +351,28 @@ static int setup_test(struct evp_test *t, const struct evp_test_method *tmeth)
if (t->meth) { if (t->meth) {
t->ntests++; t->ntests++;
if (t->skip) { if (t->skip) {
t->meth = tmeth;
t->nskip++; t->nskip++;
return 1; } else {
} /* run the test */
t->err = NULL; t->err = NULL;
if (t->meth->run_test(t) != 1) { if (t->meth->run_test(t) != 1) {
fprintf(stderr, "%s test error line %d\n", fprintf(stderr, "%s test error line %d\n",
t->meth->name, t->start_line); t->meth->name, t->start_line);
return 0; return 0;
} }
if (!check_test_error(t)) { if (!check_test_error(t)) {
if (t->err) if (t->err)
ERR_print_errors_fp(stderr); ERR_print_errors_fp(stderr);
t->errors++; t->errors++;
}
} }
/* clean it up */
ERR_clear_error(); ERR_clear_error();
t->meth->cleanup(t); if (t->data != NULL) {
OPENSSL_free(t->data); t->meth->cleanup(t);
t->data = NULL; OPENSSL_free(t->data);
t->data = NULL;
}
OPENSSL_free(t->expected_err); OPENSSL_free(t->expected_err);
t->expected_err = NULL; t->expected_err = NULL;
free_expected(t); free_expected(t);
...@@ -1212,9 +1215,7 @@ static int pkey_test_init(struct evp_test *t, const char *name, ...@@ -1212,9 +1215,7 @@ static int pkey_test_init(struct evp_test *t, const char *name,
rv = find_key(&pkey, name, t->public); rv = find_key(&pkey, name, t->public);
if (!rv) if (!rv)
rv = find_key(&pkey, name, t->private); rv = find_key(&pkey, name, t->private);
if (!rv) if (!rv || pkey == NULL) {
return 0;
if (!pkey) {
t->skip = 1; t->skip = 1;
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册