lib/hcrypto: mpz2BN unsafe to call mp_to_ubin with NULL

remove the (size != 0) exception to malloc() failure.

Change-Id: I7a678b0fadd51c673491b61c06afd4203c871318
This commit is contained in:
Jeffrey Altman
2022-01-17 21:41:21 -05:00
parent 1ebebe1d2f
commit 0e3acff241

View File

@@ -67,7 +67,7 @@ mpz2BN(mp_int *s)
size = mp_ubin_size(s);
p = malloc(size);
if (p == NULL && size != 0)
if (p == NULL)
return NULL;
if (mp_to_ubin(s, p, SIZE_MAX, NULL) != MP_OKAY) {
free(p);