If mp_ubin_size(s) returns zero then mp_to_ubin() will fail and
not return MP_OKAY. If MP_OKAY is not returned, NULL is returned
to the caller of mpz2BN().
This change avoids the unnecessary memory allocation and function
calls. It also removes a dereference after null warning from
coverity.
Change-Id: I52ff2c166964e41cb4eef1dac637904bf2bf13bf