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


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

crypto/evp/evp_test.c:137:5: 
135.       /* Make copy of context and replace original */
136.       EVP_CIPHER_CTX *ctx_copy;
137. >     ctx_copy = EVP_CIPHER_CTX_new();
138.       EVP_CIPHER_CTX_copy(ctx_copy, *pctx);
139.       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:138:5: 
136.       EVP_CIPHER_CTX *ctx_copy;
137.       ctx_copy = EVP_CIPHER_CTX_new();
138. >     EVP_CIPHER_CTX_copy(ctx_copy, *pctx);
139.       EVP_CIPHER_CTX_free(*pctx);
140.       *pctx = ctx_copy;
