capi_get_key: check for NULL after allocating key
authorJonas Maebe <jonas.maebe@elis.ugent.be>
Sun, 8 Dec 2013 22:05:56 +0000 (23:05 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Thu, 4 Dec 2014 22:48:44 +0000 (23:48 +0100)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
engines/e_capi.c

index edcebf1a3f1cd5a60a0fea75735f784716f460eb..f7876f3bab3f53ab734baa2e5858a2e84d31df6c 100644 (file)
@@ -1498,6 +1498,8 @@ static CAPI_KEY *capi_get_key(CAPI_CTX *ctx, const TCHAR *contname, TCHAR *provn
        CAPI_KEY *key;
        DWORD dwFlags = 0; 
        key = OPENSSL_malloc(sizeof(CAPI_KEY));
+       if (key == NULL)
+               return NULL;
        if (sizeof(TCHAR)==sizeof(char))
                CAPI_trace(ctx, "capi_get_key, contname=%s, provname=%s, type=%d\n",
                                                contname, provname, ptype);