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: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:2: 
  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:295:1: start of procedure CRYPTO_malloc()
    293.   	}
    294.   
    295. > void *CRYPTO_malloc(int num, const char *file, int line)
    296.   	{
    297.   	void *ret = NULL;

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

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

crypto/mem.c:301:2: 
    299.   	if (num <= 0) return NULL;
    300.   
    301. > 	allow_customize = 0;
    302.   	if (malloc_debug_func != NULL)
    303.   		{

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

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

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

crypto/mem.c:324:2: 
    322.   #endif
    323.   
    324. > 	return ret;
    325.   	}
    326.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:325:2: return from a call to CRYPTO_malloc
    323.   
    324.   	return ret;
    325.   	}
            ^
    326.   char *CRYPTO_strdup(const char *str, const char *file, int line)
    327.   	{

crypto/evp/evp_enc.c:80:6: 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:2: 
  80.   	if (ctx)
  81.   		EVP_CIPHER_CTX_init(ctx);
  82. > 	return ctx;
  83.   	}
  84.   

crypto/evp/evp_enc.c:83:2: 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: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;
