old_hmac_encode: check for NULL result when allocating *pder
[openssl.git] / crypto / hmac / hm_ameth.c
index e03f24aedab983b26fb4eb995fdf5ae511c69449..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;
@@ -152,7 +154,7 @@ const EVP_PKEY_ASN1_METHOD hmac_asn1_meth =
        0,0,0,
 
        hmac_size,
-       0,
+       0, 0,
        0,0,0,0,0,0,0,
 
        hmac_key_free,