crypto/evp/evp_test.c:137: error: NULL_DEREFERENCE
  pointer `ctx_copy` last assigned on line 136 could be null and is dereferenced by call to `EVP_CIPHER_CTX_copy()` at line 137, column 5.
Showing all 17 steps of the trace


crypto/evp/evp_test.c:132:1: start of procedure test_ctx_replace()
130.   
131.   /* Test copying of contexts */
132. > static void test_ctx_replace(EVP_CIPHER_CTX **pctx)
133.   {
134.       /* Make copy of context and replace original */

crypto/evp/evp_test.c:136:5: 
134.       /* Make copy of context and replace original */
135.       EVP_CIPHER_CTX *ctx_copy;
136. >     ctx_copy = EVP_CIPHER_CTX_new();
137.       EVP_CIPHER_CTX_copy(ctx_copy, *pctx);
138.       EVP_CIPHER_CTX_free(*pctx);

crypto/evp/evp_enc.c:77:1: start of procedure EVP_CIPHER_CTX_new()
  75.   }
  76.   
  77. > EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  78.   {
  79.       EVP_CIPHER_CTX *ctx = OPENSSL_malloc(sizeof *ctx);

crypto/evp/evp_enc.c:79:5: 
  77.   EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  78.   {
  79. >     EVP_CIPHER_CTX *ctx = OPENSSL_malloc(sizeof *ctx);
  80.       if (ctx)
  81.           EVP_CIPHER_CTX_init(ctx);

crypto/mem.c:327:1: start of procedure CRYPTO_malloc()
    325.   }
    326.   
    327. > void *CRYPTO_malloc(int num, const char *file, int line)
    328.   {
    329.       void *ret = NULL;

crypto/mem.c:329:5: 
    327.   void *CRYPTO_malloc(int num, const char *file, int line)
    328.   {
    329. >     void *ret = NULL;
    330.   
    331.       if (num <= 0)

crypto/mem.c:331:9: Taking false branch
    329.       void *ret = NULL;
    330.   
    331.       if (num <= 0)
                   ^
    332.           return NULL;
    333.   

crypto/mem.c:334:9: Taking false branch
    332.           return NULL;
    333.   
    334.       if (allow_customize)
                   ^
    335.           allow_customize = 0;
    336.       if (malloc_debug_func != NULL) {

crypto/mem.c:336:9: Taking false branch
    334.       if (allow_customize)
    335.           allow_customize = 0;
    336.       if (malloc_debug_func != NULL) {
                   ^
    337.           if (allow_customize_debug)
    338.               allow_customize_debug = 0;

crypto/mem.c:341:5: Skipping __function_pointer__(): unresolved function pointer
    339.           malloc_debug_func(NULL, num, file, line, 0);
    340.       }
    341.       ret = malloc_ex_func(num, file, line);
               ^
    342.   #ifdef LEVITTE_DEBUG_MEM
    343.       fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:345:9: Taking false branch
    343.       fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
    344.   #endif
    345.       if (malloc_debug_func != NULL)
                   ^
    346.           malloc_debug_func(ret, num, file, line, 1);
    347.   

crypto/mem.c:360:5: 
    358.   #endif
    359.   
    360. >     return ret;
    361.   }
    362.   

crypto/mem.c:361:1: return from a call to CRYPTO_malloc
    359.   
    360.       return ret;
    361. > }
    362.   
    363.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/evp/evp_enc.c:80:9: Taking false branch
  78.   {
  79.       EVP_CIPHER_CTX *ctx = OPENSSL_malloc(sizeof *ctx);
  80.       if (ctx)
                ^
  81.           EVP_CIPHER_CTX_init(ctx);
  82.       return ctx;

crypto/evp/evp_enc.c:82:5: 
  80.       if (ctx)
  81.           EVP_CIPHER_CTX_init(ctx);
  82. >     return ctx;
  83.   }
  84.   

crypto/evp/evp_enc.c:83:1: return from a call to EVP_CIPHER_CTX_new
  81.           EVP_CIPHER_CTX_init(ctx);
  82.       return ctx;
  83. > }
  84.   
  85.   int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,

crypto/evp/evp_test.c:137:5: 
135.       EVP_CIPHER_CTX *ctx_copy;
136.       ctx_copy = EVP_CIPHER_CTX_new();
137. >     EVP_CIPHER_CTX_copy(ctx_copy, *pctx);
138.       EVP_CIPHER_CTX_free(*pctx);
139.       *pctx = ctx_copy;

static void test_ctx_replace(EVP_CIPHER_CTX **pctx)
{
    EVP_CIPHER_CTX *ctx_copy;
    ctx_copy = EVP_CIPHER_CTX_new();
    EVP_CIPHER_CTX_copy(ctx_copy, *pctx);
    EVP_CIPHER_CTX_free(*pctx);
    *pctx = ctx_copy;
}
['static void test_ctx_replace(EVP_CIPHER_CTX **pctx)\n{\n    EVP_CIPHER_CTX *ctx_copy;\n    ctx_copy = EVP_CIPHER_CTX_new();\n    EVP_CIPHER_CTX_copy(ctx_copy, *pctx);\n    EVP_CIPHER_CTX_free(*pctx);\n    *pctx = ctx_copy;\n}', 'EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)\n{\n    EVP_CIPHER_CTX *ctx = OPENSSL_malloc(sizeof *ctx);\n    if (ctx)\n        EVP_CIPHER_CTX_init(ctx);\n    return ctx;\n}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    if (allow_customize)\n        allow_customize = 0;\n    if (malloc_debug_func != NULL) {\n        if (allow_customize_debug)\n            allow_customize_debug = 0;\n        malloc_debug_func(NULL, num, file, line, 0);\n    }\n    ret = malloc_ex_func(num, file, line);\n#ifdef LEVITTE_DEBUG_MEM\n    fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n    if (malloc_debug_func != NULL)\n        malloc_debug_func(ret, num, file, line, 1);\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']