Skip to content

Commit

Permalink
check the return value of BN_new() and BN_dup()
Browse files Browse the repository at this point in the history
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#16948)
  • Loading branch information
x2018 authored and t8m committed Nov 3, 2021
1 parent 6450ea2 commit d99004f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/testutil/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ int test_BN_eq_word(const char *file, int line, const char *bns, const char *ws,

if (a != NULL && BN_is_word(a, w))
return 1;
bw = BN_new();
BN_set_word(bw, w);
if ((bw = BN_new()) != NULL)
BN_set_word(bw, w);
test_fail_bignum_message(NULL, file, line, "BIGNUM", bns, ws, "==", a, bw);
BN_free(bw);
return 0;
Expand All @@ -431,10 +431,10 @@ int test_BN_abs_eq_word(const char *file, int line, const char *bns,

if (a != NULL && BN_abs_is_word(a, w))
return 1;
bw = BN_new();
aa = BN_dup(a);
BN_set_negative(aa, 0);
BN_set_word(bw, w);
if ((aa = BN_dup(a)) != NULL)
BN_set_negative(aa, 0);
if ((bw = BN_new()) != NULL)
BN_set_word(bw, w);
test_fail_bignum_message(NULL, file, line, "BIGNUM", bns, ws, "abs==",
aa, bw);
BN_free(bw);
Expand Down

0 comments on commit d99004f

Please sign in to comment.