crypto/evp/pmeth_lib.c:309: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 283, column 12 is not reachable after line 309, column 5.
Showing all 43 steps of the trace


crypto/evp/pmeth_lib.c:271:1: start of procedure EVP_PKEY_CTX_dup()
269.   }
270.   
271. > EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx)
272.   {
273.       EVP_PKEY_CTX *rctx;

crypto/evp/pmeth_lib.c:274:10: Taking false branch
272.   {
273.       EVP_PKEY_CTX *rctx;
274.       if (!pctx->pmeth || !pctx->pmeth->copy)
                ^
275.           return NULL;
276.   #ifndef OPENSSL_NO_ENGINE

crypto/evp/pmeth_lib.c:274:26: Taking false branch
272.   {
273.       EVP_PKEY_CTX *rctx;
274.       if (!pctx->pmeth || !pctx->pmeth->copy)
                                ^
275.           return NULL;
276.   #ifndef OPENSSL_NO_ENGINE

crypto/evp/pmeth_lib.c:278:9: Taking false branch
276.   #ifndef OPENSSL_NO_ENGINE
277.       /* Make sure it's safe to copy a pkey context using an ENGINE */
278.       if (pctx->engine && !ENGINE_init(pctx->engine)) {
               ^
279.           EVPerr(EVP_F_EVP_PKEY_CTX_DUP, ERR_R_ENGINE_LIB);
280.           return 0;

crypto/evp/pmeth_lib.c:283:5: 
281.       }
282.   #endif
283. >     rctx = OPENSSL_malloc(sizeof(*rctx));
284.       if (rctx == NULL)
285.           return NULL;

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
  117.   }
  118.   
  119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  120.   {
  121.       void *ret = NULL;

crypto/mem.c:121:5: 
  119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  120.   {
  121. >     void *ret = NULL;
  122.   
  123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
  121.       void *ret = NULL;
  122.   
  123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  124.           return malloc_impl(num, file, line);
  125.   

crypto/mem.c:126:9: Taking false branch
  124.           return malloc_impl(num, file, line);
  125.   
  126.       if (num <= 0)
                 ^
  127.           return NULL;
  128.   

crypto/mem.c:129:5: 
  127.           return NULL;
  128.   
  129. >     allow_customize = 0;
  130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
  137.       }
  138.   #else
  139. >     osslargused(file); osslargused(line);
  140.       ret = malloc(num);
  141.   #endif

crypto/mem.c:139:24: 
  137.       }
  138.   #else
  139. >     osslargused(file); osslargused(line);
  140.       ret = malloc(num);
  141.   #endif

crypto/mem.c:140:5: 
  138.   #else
  139.       osslargused(file); osslargused(line);
  140. >     ret = malloc(num);
  141.   #endif
  142.   

crypto/mem.c:143:5: 
  141.   #endif
  142.   
  143. >     return ret;
  144.   }
  145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
  142.   
  143.       return ret;
  144. > }
  145.   
  146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/evp/pmeth_lib.c:284:9: Taking false branch
282.   #endif
283.       rctx = OPENSSL_malloc(sizeof(*rctx));
284.       if (rctx == NULL)
               ^
285.           return NULL;
286.   

crypto/evp/pmeth_lib.c:287:5: 
285.           return NULL;
286.   
287. >     rctx->pmeth = pctx->pmeth;
288.   #ifndef OPENSSL_NO_ENGINE
289.       rctx->engine = pctx->engine;

crypto/evp/pmeth_lib.c:289:5: 
287.       rctx->pmeth = pctx->pmeth;
288.   #ifndef OPENSSL_NO_ENGINE
289. >     rctx->engine = pctx->engine;
290.   #endif
291.   

crypto/evp/pmeth_lib.c:292:9: Taking true branch
290.   #endif
291.   
292.       if (pctx->pkey)
               ^
293.           EVP_PKEY_up_ref(pctx->pkey);
294.   

crypto/evp/pmeth_lib.c:293:9: 
291.   
292.       if (pctx->pkey)
293. >         EVP_PKEY_up_ref(pctx->pkey);
294.   
295.       rctx->pkey = pctx->pkey;

crypto/evp/p_lib.c:208:1: start of procedure EVP_PKEY_up_ref()
  206.   }
  207.   
  208. > void EVP_PKEY_up_ref(EVP_PKEY *pkey)
  209.   {
  210.       int i;

crypto/evp/p_lib.c:211:5: 
  209.   {
  210.       int i;
  211. >     CRYPTO_atomic_add(&pkey->references, 1, &i, pkey->lock);
  212.   }
  213.   

crypto/threads_pthread.c:151:1: start of procedure CRYPTO_atomic_add()
    149.   }
    150.   
    151. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
    152.   {
    153.   #ifdef __ATOMIC_RELAXED

crypto/threads_pthread.c:154:5: 
    152.   {
    153.   #ifdef __ATOMIC_RELAXED
    154. >     *ret = __atomic_add_fetch(val, amount, __ATOMIC_RELAXED);
    155.   #else
    156.       if (!CRYPTO_THREAD_write_lock(lock))

crypto/threads_pthread.c:166:5: 
    164.   #endif
    165.   
    166. >     return 1;
    167.   }
    168.   

crypto/threads_pthread.c:167:1: return from a call to CRYPTO_atomic_add
    165.   
    166.       return 1;
    167. > }
    168.   
    169.   #endif

crypto/evp/p_lib.c:212:1: return from a call to EVP_PKEY_up_ref
  210.       int i;
  211.       CRYPTO_atomic_add(&pkey->references, 1, &i, pkey->lock);
  212. > }
  213.   
  214.   /*

crypto/evp/pmeth_lib.c:295:5: 
293.           EVP_PKEY_up_ref(pctx->pkey);
294.   
295. >     rctx->pkey = pctx->pkey;
296.   
297.       if (pctx->peerkey)

crypto/evp/pmeth_lib.c:297:9: Taking true branch
295.       rctx->pkey = pctx->pkey;
296.   
297.       if (pctx->peerkey)
               ^
298.           EVP_PKEY_up_ref(pctx->peerkey);
299.   

crypto/evp/pmeth_lib.c:298:9: 
296.   
297.       if (pctx->peerkey)
298. >         EVP_PKEY_up_ref(pctx->peerkey);
299.   
300.       rctx->peerkey = pctx->peerkey;

crypto/evp/p_lib.c:208:1: start of procedure EVP_PKEY_up_ref()
  206.   }
  207.   
  208. > void EVP_PKEY_up_ref(EVP_PKEY *pkey)
  209.   {
  210.       int i;

crypto/evp/p_lib.c:211:5: 
  209.   {
  210.       int i;
  211. >     CRYPTO_atomic_add(&pkey->references, 1, &i, pkey->lock);
  212.   }
  213.   

crypto/threads_pthread.c:151:1: start of procedure CRYPTO_atomic_add()
    149.   }
    150.   
    151. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
    152.   {
    153.   #ifdef __ATOMIC_RELAXED

crypto/threads_pthread.c:154:5: 
    152.   {
    153.   #ifdef __ATOMIC_RELAXED
    154. >     *ret = __atomic_add_fetch(val, amount, __ATOMIC_RELAXED);
    155.   #else
    156.       if (!CRYPTO_THREAD_write_lock(lock))

crypto/threads_pthread.c:166:5: 
    164.   #endif
    165.   
    166. >     return 1;
    167.   }
    168.   

crypto/threads_pthread.c:167:1: return from a call to CRYPTO_atomic_add
    165.   
    166.       return 1;
    167. > }
    168.   
    169.   #endif

crypto/evp/p_lib.c:212:1: return from a call to EVP_PKEY_up_ref
  210.       int i;
  211.       CRYPTO_atomic_add(&pkey->references, 1, &i, pkey->lock);
  212. > }
  213.   
  214.   /*

crypto/evp/pmeth_lib.c:300:5: 
298.           EVP_PKEY_up_ref(pctx->peerkey);
299.   
300. >     rctx->peerkey = pctx->peerkey;
301.   
302.       rctx->data = NULL;

crypto/evp/pmeth_lib.c:302:5: 
300.       rctx->peerkey = pctx->peerkey;
301.   
302. >     rctx->data = NULL;
303.       rctx->app_data = NULL;
304.       rctx->operation = pctx->operation;

crypto/evp/pmeth_lib.c:303:5: 
301.   
302.       rctx->data = NULL;
303. >     rctx->app_data = NULL;
304.       rctx->operation = pctx->operation;
305.   

crypto/evp/pmeth_lib.c:304:5: 
302.       rctx->data = NULL;
303.       rctx->app_data = NULL;
304. >     rctx->operation = pctx->operation;
305.   
306.       if (pctx->pmeth->copy(rctx, pctx) > 0)

crypto/evp/pmeth_lib.c:306:9: Taking false branch
304.       rctx->operation = pctx->operation;
305.   
306.       if (pctx->pmeth->copy(rctx, pctx) > 0)
               ^
307.           return rctx;
308.   

crypto/evp/pmeth_lib.c:309:5: Skipping EVP_PKEY_CTX_free(): empty list of specs
307.           return rctx;
308.   
309.       EVP_PKEY_CTX_free(rctx);
           ^
310.       return NULL;
311.   
