diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c index 439cfa27c..c382e7e41 100644 --- a/crypto/ec/ec_key.c +++ b/crypto/ec/ec_key.c @@ -583,8 +583,8 @@ size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf) size_t len; unsigned char *buf; len = EC_KEY_priv2oct(eckey, NULL, 0); - if (len == 0 || pbuf == NULL) - return len; + if (len == 0) + return 0; buf = OPENSSL_malloc(len); if (buf == NULL) return 0;