crypto/evp/pmeth_lib.c:184: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_zalloc()` at line 167, column 11 is not reachable after line 184, column 13.
Showing all 86 steps of the trace


crypto/evp/pmeth_lib.c:130:1: start of procedure int_ctx_new()
128.   }
129.   
130. > static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
131.   {
132.       EVP_PKEY_CTX *ret;

crypto/evp/pmeth_lib.c:134:9: Taking true branch
132.       EVP_PKEY_CTX *ret;
133.       const EVP_PKEY_METHOD *pmeth;
134.       if (id == -1) {
               ^
135.           if (!pkey || !pkey->ameth)
136.               return NULL;

crypto/evp/pmeth_lib.c:135:14: Taking false branch
133.       const EVP_PKEY_METHOD *pmeth;
134.       if (id == -1) {
135.           if (!pkey || !pkey->ameth)
                    ^
136.               return NULL;
137.           id = pkey->ameth->pkey_id;

crypto/evp/pmeth_lib.c:135:23: Taking false branch
133.       const EVP_PKEY_METHOD *pmeth;
134.       if (id == -1) {
135.           if (!pkey || !pkey->ameth)
                             ^
136.               return NULL;
137.           id = pkey->ameth->pkey_id;

crypto/evp/pmeth_lib.c:137:9: 
135.           if (!pkey || !pkey->ameth)
136.               return NULL;
137. >         id = pkey->ameth->pkey_id;
138.       }
139.   #ifndef OPENSSL_NO_ENGINE

crypto/evp/pmeth_lib.c:140:9: Taking true branch
138.       }
139.   #ifndef OPENSSL_NO_ENGINE
140.       if (pkey && pkey->engine)
               ^
141.           e = pkey->engine;
142.       /* Try to find an ENGINE which implements this method */

crypto/evp/pmeth_lib.c:140:17: Taking false branch
138.       }
139.   #ifndef OPENSSL_NO_ENGINE
140.       if (pkey && pkey->engine)
                       ^
141.           e = pkey->engine;
142.       /* Try to find an ENGINE which implements this method */

crypto/evp/pmeth_lib.c:143:9: Taking false branch
141.           e = pkey->engine;
142.       /* Try to find an ENGINE which implements this method */
143.       if (e) {
               ^
144.           if (!ENGINE_init(e)) {
145.               EVPerr(EVP_F_INT_CTX_NEW, ERR_R_ENGINE_LIB);

crypto/evp/pmeth_lib.c:149:9: 
147.           }
148.       } else
149. >         e = ENGINE_get_pkey_meth_engine(id);
150.   
151.       /*

crypto/engine/tb_pkmeth.c:109:1: start of procedure ENGINE_get_pkey_meth_engine()
  107.    * references) for a given pkey_meth 'nid'
  108.    */
  109. > ENGINE *ENGINE_get_pkey_meth_engine(int nid)
  110.   {
  111.       return engine_table_select(&pkey_meth_table, nid);

crypto/engine/tb_pkmeth.c:111:5: 
  109.   ENGINE *ENGINE_get_pkey_meth_engine(int nid)
  110.   {
  111. >     return engine_table_select(&pkey_meth_table, nid);
  112.   }
  113.   

crypto/engine/eng_table.c:233:1: start of procedure engine_table_select()
    231.   /* return a functional reference for a given 'nid' */
    232.   #ifndef ENGINE_TABLE_DEBUG
    233. > ENGINE *engine_table_select(ENGINE_TABLE **table, int nid)
    234.   #else
    235.   ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,

crypto/engine/eng_table.c:239:5: 
    237.   #endif
    238.   {
    239. >     ENGINE *ret = NULL;
    240.       ENGINE_PILE tmplate, *fnd = NULL;
    241.       int initres, loop = 0;

crypto/engine/eng_table.c:240:5: 
    238.   {
    239.       ENGINE *ret = NULL;
    240. >     ENGINE_PILE tmplate, *fnd = NULL;
    241.       int initres, loop = 0;
    242.   

crypto/engine/eng_table.c:241:5: 
    239.       ENGINE *ret = NULL;
    240.       ENGINE_PILE tmplate, *fnd = NULL;
    241. >     int initres, loop = 0;
    242.   
    243.       if (!(*table)) {

crypto/engine/eng_table.c:243:11: 
    241.       int initres, loop = 0;
    242.   
    243. >     if (!(*table)) {
    244.   #ifdef ENGINE_TABLE_DEBUG
    245.           fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing "

crypto/engine/eng_table.c:243:10: Taking true branch
    241.       int initres, loop = 0;
    242.   
    243.       if (!(*table)) {
                    ^
    244.   #ifdef ENGINE_TABLE_DEBUG
    245.           fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing "

crypto/engine/eng_table.c:248:9: 
    246.                   "registered!\n", f, l, nid);
    247.   #endif
    248. >         return NULL;
    249.       }
    250.       ERR_set_mark();

crypto/engine/eng_table.c:329:1: return from a call to engine_table_select
    327.       ERR_pop_to_mark();
    328.       return ret;
    329. > }
    330.   
    331.   /* Table enumeration */

crypto/engine/tb_pkmeth.c:112:1: return from a call to ENGINE_get_pkey_meth_engine
  110.   {
  111.       return engine_table_select(&pkey_meth_table, nid);
  112. > }
  113.   
  114.   /* Obtains a pkey_meth implementation from an ENGINE functional reference */

crypto/evp/pmeth_lib.c:156:9: Taking false branch
154.        */
155.   
156.       if (e)
               ^
157.           pmeth = ENGINE_get_pkey_meth(e, id);
158.       else

crypto/evp/pmeth_lib.c:160:9: 
158.       else
159.   #endif
160. >         pmeth = EVP_PKEY_meth_find(id);
161.   
162.       if (pmeth == NULL) {

crypto/evp/pmeth_lib.c:111:1: start of procedure EVP_PKEY_meth_find()
  109.                                pmeth);
  110.   
  111. > const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type)
  112.   {
  113.       EVP_PKEY_METHOD tmp;

crypto/evp/pmeth_lib.c:114:5: 
  112.   {
  113.       EVP_PKEY_METHOD tmp;
  114. >     const EVP_PKEY_METHOD *t = &tmp, **ret;
  115.       tmp.pkey_id = type;
  116.       if (app_pkey_methods) {

crypto/evp/pmeth_lib.c:115:5: 
  113.       EVP_PKEY_METHOD tmp;
  114.       const EVP_PKEY_METHOD *t = &tmp, **ret;
  115. >     tmp.pkey_id = type;
  116.       if (app_pkey_methods) {
  117.           int idx;

crypto/evp/pmeth_lib.c:116:9: Taking true branch
  114.       const EVP_PKEY_METHOD *t = &tmp, **ret;
  115.       tmp.pkey_id = type;
  116.       if (app_pkey_methods) {
                 ^
  117.           int idx;
  118.           idx = sk_EVP_PKEY_METHOD_find(app_pkey_methods, &tmp);

crypto/evp/pmeth_lib.c:118:9: 
  116.       if (app_pkey_methods) {
  117.           int idx;
  118. >         idx = sk_EVP_PKEY_METHOD_find(app_pkey_methods, &tmp);
  119.           if (idx >= 0)
  120.               return sk_EVP_PKEY_METHOD_value(app_pkey_methods, idx);

crypto/include/internal/evp_int.h:122:1: start of procedure sk_EVP_PKEY_METHOD_find()
    120.   } /* EVP_PKEY_METHOD */ ;
    121.   
    122. > DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD)
    123.   
    124.   void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);

crypto/stack/stack.c:248:1: start of procedure sk_find()
      246.   }
      247.   
      248. > int sk_find(_STACK *st, void *data)
      249.   {
      250.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);

crypto/stack/stack.c:250:5: 
      248.   int sk_find(_STACK *st, void *data)
      249.   {
      250. >     return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
      251.   }
      252.   

crypto/stack/stack.c:224:1: start of procedure internal_find()
        222.   }
        223.   
        224. > static int internal_find(_STACK *st, void *data, int ret_val_options)
        225.   {
        226.       const void *const *r;

crypto/stack/stack.c:229:9: Taking false branch
        227.       int i;
        228.   
        229.       if (st == NULL)
                       ^
        230.           return -1;
        231.   

crypto/stack/stack.c:232:9: Taking true branch
        230.           return -1;
        231.   
        232.       if (st->comp == NULL) {
                       ^
        233.           for (i = 0; i < st->num; i++)
        234.               if (st->data[i] == data)

crypto/stack/stack.c:233:14: 
        231.   
        232.       if (st->comp == NULL) {
        233. >         for (i = 0; i < st->num; i++)
        234.               if (st->data[i] == data)
        235.                   return (i);

crypto/stack/stack.c:233:21: Loop condition is true. Entering loop body
        231.   
        232.       if (st->comp == NULL) {
        233.           for (i = 0; i < st->num; i++)
                                   ^
        234.               if (st->data[i] == data)
        235.                   return (i);

crypto/stack/stack.c:234:17: Taking true branch
        232.       if (st->comp == NULL) {
        233.           for (i = 0; i < st->num; i++)
        234.               if (st->data[i] == data)
                               ^
        235.                   return (i);
        236.           return (-1);

crypto/stack/stack.c:235:17: 
        233.           for (i = 0; i < st->num; i++)
        234.               if (st->data[i] == data)
        235. >                 return (i);
        236.           return (-1);
        237.       }

crypto/stack/stack.c:246:1: return from a call to internal_find
        244.           return (-1);
        245.       return (int)((char **)r - st->data);
        246. > }
        247.   
        248.   int sk_find(_STACK *st, void *data)

crypto/stack/stack.c:251:1: return from a call to sk_find
      249.   {
      250.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
      251. > }
      252.   
      253.   int sk_find_ex(_STACK *st, void *data)

crypto/include/internal/evp_int.h:122:1: return from a call to sk_EVP_PKEY_METHOD_find
    120.   } /* EVP_PKEY_METHOD */ ;
    121.   
    122. > DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD)
    123.   
    124.   void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);

crypto/evp/pmeth_lib.c:119:13: Taking true branch
  117.           int idx;
  118.           idx = sk_EVP_PKEY_METHOD_find(app_pkey_methods, &tmp);
  119.           if (idx >= 0)
                     ^
  120.               return sk_EVP_PKEY_METHOD_value(app_pkey_methods, idx);
  121.       }

crypto/evp/pmeth_lib.c:120:13: 
  118.           idx = sk_EVP_PKEY_METHOD_find(app_pkey_methods, &tmp);
  119.           if (idx >= 0)
  120. >             return sk_EVP_PKEY_METHOD_value(app_pkey_methods, idx);
  121.       }
  122.       ret = OBJ_bsearch_pmeth(&t, standard_methods,

crypto/include/internal/evp_int.h:122:1: start of procedure sk_EVP_PKEY_METHOD_value()
    120.   } /* EVP_PKEY_METHOD */ ;
    121.   
    122. > DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD)
    123.   
    124.   void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);

crypto/stack/stack.c:323:1: start of procedure sk_value()
      321.   }
      322.   
      323. > void *sk_value(const _STACK *st, int i)
      324.   {
      325.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:325:10: Taking false branch
      323.   void *sk_value(const _STACK *st, int i)
      324.   {
      325.       if (!st || (i < 0) || (i >= st->num))
                      ^
      326.           return NULL;
      327.       return st->data[i];

crypto/stack/stack.c:325:17: Taking false branch
      323.   void *sk_value(const _STACK *st, int i)
      324.   {
      325.       if (!st || (i < 0) || (i >= st->num))
                             ^
      326.           return NULL;
      327.       return st->data[i];

crypto/stack/stack.c:325:28: Taking false branch
      323.   void *sk_value(const _STACK *st, int i)
      324.   {
      325.       if (!st || (i < 0) || (i >= st->num))
                                        ^
      326.           return NULL;
      327.       return st->data[i];

crypto/stack/stack.c:327:5: 
      325.       if (!st || (i < 0) || (i >= st->num))
      326.           return NULL;
      327. >     return st->data[i];
      328.   }
      329.   

crypto/stack/stack.c:328:1: return from a call to sk_value
      326.           return NULL;
      327.       return st->data[i];
      328. > }
      329.   
      330.   void *sk_set(_STACK *st, int i, void *value)

crypto/include/internal/evp_int.h:122:1: return from a call to sk_EVP_PKEY_METHOD_value
    120.   } /* EVP_PKEY_METHOD */ ;
    121.   
    122. > DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD)
    123.   
    124.   void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);

crypto/evp/pmeth_lib.c:128:1: return from a call to EVP_PKEY_meth_find
  126.           return NULL;
  127.       return *ret;
  128. > }
  129.   
  130.   static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)

crypto/evp/pmeth_lib.c:162:9: Taking false branch
160.           pmeth = EVP_PKEY_meth_find(id);
161.   
162.       if (pmeth == NULL) {
               ^
163.           EVPerr(EVP_F_INT_CTX_NEW, EVP_R_UNSUPPORTED_ALGORITHM);
164.           return NULL;

crypto/evp/pmeth_lib.c:167:5: 
165.       }
166.   
167. >     ret = OPENSSL_zalloc(sizeof(*ret));
168.       if (ret == NULL) {
169.   #ifndef OPENSSL_NO_ENGINE

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
  144.   }
  145.   
  146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
  146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148. >     void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       if (ret != 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/mem.c:150:9: Taking true branch
  148.       void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       if (ret != NULL)
                 ^
  151.           memset(ret, 0, num);
  152.       return ret;

crypto/mem.c:151:9: 
  149.   
  150.       if (ret != NULL)
  151. >         memset(ret, 0, num);
  152.       return ret;
  153.   }

crypto/mem.c:152:5: 
  150.       if (ret != NULL)
  151.           memset(ret, 0, num);
  152. >     return ret;
  153.   }
  154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
  151.           memset(ret, 0, num);
  152.       return ret;
  153. > }
  154.   
  155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/pmeth_lib.c:168:9: Taking false branch
166.   
167.       ret = OPENSSL_zalloc(sizeof(*ret));
168.       if (ret == NULL) {
               ^
169.   #ifndef OPENSSL_NO_ENGINE
170.           ENGINE_finish(e);

crypto/evp/pmeth_lib.c:175:5: 
173.           return NULL;
174.       }
175. >     ret->engine = e;
176.       ret->pmeth = pmeth;
177.       ret->operation = EVP_PKEY_OP_UNDEFINED;

crypto/evp/pmeth_lib.c:176:5: 
174.       }
175.       ret->engine = e;
176. >     ret->pmeth = pmeth;
177.       ret->operation = EVP_PKEY_OP_UNDEFINED;
178.       ret->pkey = pkey;

crypto/evp/pmeth_lib.c:177:5: 
175.       ret->engine = e;
176.       ret->pmeth = pmeth;
177. >     ret->operation = EVP_PKEY_OP_UNDEFINED;
178.       ret->pkey = pkey;
179.       if (pkey)

crypto/evp/pmeth_lib.c:178:5: 
176.       ret->pmeth = pmeth;
177.       ret->operation = EVP_PKEY_OP_UNDEFINED;
178. >     ret->pkey = pkey;
179.       if (pkey)
180.           EVP_PKEY_up_ref(pkey);

crypto/evp/pmeth_lib.c:179:9: Taking true branch
177.       ret->operation = EVP_PKEY_OP_UNDEFINED;
178.       ret->pkey = pkey;
179.       if (pkey)
               ^
180.           EVP_PKEY_up_ref(pkey);
181.   

crypto/evp/pmeth_lib.c:180:9: 
178.       ret->pkey = pkey;
179.       if (pkey)
180. >         EVP_PKEY_up_ref(pkey);
181.   
182.       if (pmeth->init) {

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:182:9: Taking true branch
180.           EVP_PKEY_up_ref(pkey);
181.   
182.       if (pmeth->init) {
               ^
183.           if (pmeth->init(ret) <= 0) {
184.               EVP_PKEY_CTX_free(ret);

crypto/evp/pmeth_lib.c:183:13: Taking true branch
181.   
182.       if (pmeth->init) {
183.           if (pmeth->init(ret) <= 0) {
                   ^
184.               EVP_PKEY_CTX_free(ret);
185.               return NULL;

crypto/evp/pmeth_lib.c:184:13: Skipping EVP_PKEY_CTX_free(): empty list of specs
182.       if (pmeth->init) {
183.           if (pmeth->init(ret) <= 0) {
184.               EVP_PKEY_CTX_free(ret);
                   ^
185.               return NULL;
186.           }
