capi_cert_get_fname: check for NULL after allocating wfname