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


crypto/evp/evp_test.c:137:1: start of procedure test_ctx_replace()
135.   
136.   /* Test copying of contexts */
137. > static void test_ctx_replace(EVP_CIPHER_CTX **pctx)
138.   	{
139.   	/* Make copy of context and replace original */

crypto/evp/evp_test.c:141:2: 
139.   	/* Make copy of context and replace original */
140.   	EVP_CIPHER_CTX *ctx_copy;
141. > 	ctx_copy = EVP_CIPHER_CTX_new();
142.   	EVP_CIPHER_CTX_copy(ctx_copy, *pctx);
143.   	EVP_CIPHER_CTX_free(*pctx);

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

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

crypto/mem.c:297:1: start of procedure CRYPTO_malloc()
    295.   	}
    296.   
    297. > void *CRYPTO_malloc(int num, const char *file, int line)
    298.   	{
    299.   	void *ret = NULL;

crypto/mem.c:299:2: 
    297.   void *CRYPTO_malloc(int num, const char *file, int line)
    298.   	{
    299. > 	void *ret = NULL;
    300.   
    301.   	if (num <= 0) return NULL;

crypto/mem.c:301:6: Taking false branch
    299.   	void *ret = NULL;
    300.   
    301.   	if (num <= 0) return NULL;
                ^
    302.   
    303.   	if(allow_customize)

crypto/mem.c:303:5: Taking false branch
    301.   	if (num <= 0) return NULL;
    302.   
    303.   	if(allow_customize)
               ^
    304.   		allow_customize = 0;
    305.   	if (malloc_debug_func != NULL)

crypto/mem.c:305:6: Taking false branch
    303.   	if(allow_customize)
    304.   		allow_customize = 0;
    305.   	if (malloc_debug_func != NULL)
                ^
    306.   		{
    307.   		if(allow_customize_debug)

crypto/mem.c:311:2: Skipping __function_pointer__(): unresolved function pointer
    309.   		malloc_debug_func(NULL, num, file, line, 0);
    310.   		}
    311.   	ret = malloc_ex_func(num,file,line);
            ^
    312.   #ifdef LEVITTE_DEBUG_MEM
    313.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:315:6: Taking false branch
    313.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
    314.   #endif
    315.   	if (malloc_debug_func != NULL)
                ^
    316.   		malloc_debug_func(ret, num, file, line, 1);
    317.   

crypto/mem.c:328:2: 
    326.   #endif
    327.   
    328. > 	return ret;
    329.   	}
    330.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:329:2: return from a call to CRYPTO_malloc
    327.   
    328.   	return ret;
    329.   	}
            ^
    330.   char *CRYPTO_strdup(const char *str, const char *file, int line)
    331.   	{

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

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

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

crypto/evp/evp_test.c:142:2: 
140.   	EVP_CIPHER_CTX *ctx_copy;
141.   	ctx_copy = EVP_CIPHER_CTX_new();
142. > 	EVP_CIPHER_CTX_copy(ctx_copy, *pctx);
143.   	EVP_CIPHER_CTX_free(*pctx);
144.   	*pctx = ctx_copy;
