old_hmac_encode: check for NULL result when allocating *pder
[openssl.git] / crypto / hmac / hm_ameth.c
index a6aa7931108c6d5ab4d222da1de53edb3782977c..3d998e94da861f0ea20a17a324d927614b10134d 100644 (file)
@@ -123,6 +123,8 @@ static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder)
                if (!*pder)
                        {
                        *pder = OPENSSL_malloc(os->length);
+                       if (*pder == NULL)
+                               return -1;
                        inc = 0;
                        }
                else inc = 1;