crypto/dsa/dsa_lib.c:159: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_zalloc()` at line 116, column 11 is not reachable after line 159, column 9.
Showing all 85 steps of the trace


crypto/dsa/dsa_lib.c:112:1: start of procedure DSA_new_method()
110.   }
111.   
112. > DSA *DSA_new_method(ENGINE *engine)
113.   {
114.       DSA *ret;

crypto/dsa/dsa_lib.c:116:5: 
114.       DSA *ret;
115.   
116. >     ret = OPENSSL_zalloc(sizeof(*ret));
117.       if (ret == NULL) {
118.           DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);

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/dsa/dsa_lib.c:117:9: Taking false branch
115.   
116.       ret = OPENSSL_zalloc(sizeof(*ret));
117.       if (ret == NULL) {
               ^
118.           DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
119.           return NULL;

crypto/dsa/dsa_lib.c:121:5: 
119.           return NULL;
120.       }
121. >     ret->meth = DSA_get_default_method();
122.   #ifndef OPENSSL_NO_ENGINE
123.       if (engine) {

crypto/dsa/dsa_lib.c:75:1: start of procedure DSA_get_default_method()
  73.   }
  74.   
  75. > const DSA_METHOD *DSA_get_default_method(void)
  76.   {
  77.       if (!default_DSA_method)

crypto/dsa/dsa_lib.c:77:10: Taking false branch
  75.   const DSA_METHOD *DSA_get_default_method(void)
  76.   {
  77.       if (!default_DSA_method)
                 ^
  78.           default_DSA_method = DSA_OpenSSL();
  79.       return default_DSA_method;

crypto/dsa/dsa_lib.c:79:5: 
  77.       if (!default_DSA_method)
  78.           default_DSA_method = DSA_OpenSSL();
  79. >     return default_DSA_method;
  80.   }
  81.   

crypto/dsa/dsa_lib.c:80:1: return from a call to DSA_get_default_method
  78.           default_DSA_method = DSA_OpenSSL();
  79.       return default_DSA_method;
  80. > }
  81.   
  82.   DSA *DSA_new(void)

crypto/dsa/dsa_lib.c:123:9: Taking false branch
121.       ret->meth = DSA_get_default_method();
122.   #ifndef OPENSSL_NO_ENGINE
123.       if (engine) {
               ^
124.           if (!ENGINE_init(engine)) {
125.               DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB);

crypto/dsa/dsa_lib.c:131:9: 
129.           ret->engine = engine;
130.       } else
131. >         ret->engine = ENGINE_get_default_DSA();
132.       if (ret->engine) {
133.           ret->meth = ENGINE_get_DSA(ret->engine);

crypto/engine/tb_dsa.c:101:1: start of procedure ENGINE_get_default_DSA()
  99.    * references).
  100.    */
  101. > ENGINE *ENGINE_get_default_DSA(void)
  102.   {
  103.       return engine_table_select(&dsa_table, dummy_nid);

crypto/engine/tb_dsa.c:103:5: 
  101.   ENGINE *ENGINE_get_default_DSA(void)
  102.   {
  103. >     return engine_table_select(&dsa_table, dummy_nid);
  104.   }
  105.   

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_dsa.c:104:1: return from a call to ENGINE_get_default_DSA
  102.   {
  103.       return engine_table_select(&dsa_table, dummy_nid);
  104. > }
  105.   
  106.   /* Obtains an DSA implementation from an ENGINE functional reference */

crypto/dsa/dsa_lib.c:132:9: Taking false branch
130.       } else
131.           ret->engine = ENGINE_get_default_DSA();
132.       if (ret->engine) {
               ^
133.           ret->meth = ENGINE_get_DSA(ret->engine);
134.           if (ret->meth == NULL) {

crypto/dsa/dsa_lib.c:143:5: 
141.   #endif
142.   
143. >     ret->references = 1;
144.       ret->flags = ret->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW;
145.   

crypto/dsa/dsa_lib.c:144:5: 
142.   
143.       ret->references = 1;
144. >     ret->flags = ret->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW;
145.   
146.       CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data);

crypto/dsa/dsa_lib.c:146:5: 
144.       ret->flags = ret->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW;
145.   
146. >     CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data);
147.   
148.       ret->lock = CRYPTO_THREAD_lock_new();

crypto/ex_data.c:304:1: start of procedure CRYPTO_new_ex_data()
  302.    * to the global "ex_data" state (ie. class definitions), not 'ad' itself.
  303.    */
  304. > int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
  305.   {
  306.       int mx, i;

crypto/ex_data.c:308:5: 
  306.       int mx, i;
  307.       void *ptr;
  308. >     EX_CALLBACK **storage = NULL;
  309.       EX_CALLBACK *stack[10];
  310.       EX_CALLBACKS *ip = get_and_lock(class_index);

crypto/ex_data.c:310:5: 
  308.       EX_CALLBACK **storage = NULL;
  309.       EX_CALLBACK *stack[10];
  310. >     EX_CALLBACKS *ip = get_and_lock(class_index);
  311.   
  312.       if (ip == NULL)

crypto/ex_data.c:149:1: start of procedure get_and_lock()
    147.    * a given class.  On success, *holds the lock.*
    148.    */
    149. > static EX_CALLBACKS *get_and_lock(int class_index)
    150.   {
    151.       EX_CALLBACKS *ip;

crypto/ex_data.c:153:9: Taking false branch
    151.       EX_CALLBACKS *ip;
    152.   
    153.       if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
                   ^
    154.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_PASSED_INVALID_ARGUMENT);
    155.           return NULL;

crypto/ex_data.c:153:28: Taking false branch
    151.       EX_CALLBACKS *ip;
    152.   
    153.       if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
                                      ^
    154.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_PASSED_INVALID_ARGUMENT);
    155.           return NULL;

crypto/ex_data.c:158:5: 
    156.       }
    157.   
    158. >     CRYPTO_THREAD_run_once(&ex_data_init, do_ex_data_init);
    159.   
    160.       if (ex_data_lock == NULL) {

crypto/threads_pthread.c:104:1: start of procedure CRYPTO_THREAD_run_once()
      102.   }
      103.   
      104. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      105.   {
      106.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:106:9: Taking true branch
      104.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      105.   {
      106.       if (pthread_once(once, init) != 0)
                     ^
      107.           return 0;
      108.   

crypto/threads_pthread.c:107:9: 
      105.   {
      106.       if (pthread_once(once, init) != 0)
      107. >         return 0;
      108.   
      109.       return 1;

crypto/threads_pthread.c:110:1: return from a call to CRYPTO_THREAD_run_once
      108.   
      109.       return 1;
      110. > }
      111.   
      112.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/ex_data.c:160:9: Taking true branch
    158.       CRYPTO_THREAD_run_once(&ex_data_init, do_ex_data_init);
    159.   
    160.       if (ex_data_lock == NULL) {
                   ^
    161.           /*
    162.            * This can happen in normal operation when using CRYPTO_mem_leaks().

crypto/ex_data.c:170:10: 
    168.            * ignore this operation. We just treat it as an error.
    169.            */
    170. >          return NULL;
    171.       }
    172.   

crypto/ex_data.c:176:1: return from a call to get_and_lock
    174.       CRYPTO_THREAD_write_lock(ex_data_lock);
    175.       return ip;
    176. > }
    177.   
    178.   static void cleanup_cb(EX_CALLBACK *funcs)

crypto/ex_data.c:312:9: Taking true branch
  310.       EX_CALLBACKS *ip = get_and_lock(class_index);
  311.   
  312.       if (ip == NULL)
                 ^
  313.           return 0;
  314.   

crypto/ex_data.c:313:9: 
  311.   
  312.       if (ip == NULL)
  313. >         return 0;
  314.   
  315.       ad->sk = NULL;

crypto/ex_data.c:343:1: return from a call to CRYPTO_new_ex_data
  341.           OPENSSL_free(storage);
  342.       return 1;
  343. > }
  344.   
  345.   /*

crypto/dsa/dsa_lib.c:148:5: 
146.       CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data);
147.   
148. >     ret->lock = CRYPTO_THREAD_lock_new();
149.       if (ret->lock == NULL) {
150.   #ifndef OPENSSL_NO_ENGINE

crypto/threads_pthread.c:55:1: start of procedure CRYPTO_THREAD_lock_new()
  53.   #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS)
  54.   
  55. > CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
  56.   {
  57.       CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));

crypto/threads_pthread.c:57:5: 
  55.   CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
  56.   {
  57. >     CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
  58.       if (lock == NULL)
  59.           return NULL;

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/threads_pthread.c:58:9: Taking false branch
  56.   {
  57.       CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
  58.       if (lock == NULL)
                ^
  59.           return NULL;
  60.   

crypto/threads_pthread.c:61:9: Taking false branch
  59.           return NULL;
  60.   
  61.       if (pthread_rwlock_init(lock, NULL) != 0) {
                ^
  62.           OPENSSL_free(lock);
  63.           return NULL;

crypto/threads_pthread.c:66:5: 
  64.       }
  65.   
  66. >     return lock;
  67.   }
  68.   

crypto/threads_pthread.c:67:1: return from a call to CRYPTO_THREAD_lock_new
  65.   
  66.       return lock;
  67. > }
  68.   
  69.   int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)

crypto/dsa/dsa_lib.c:149:9: Taking false branch
147.   
148.       ret->lock = CRYPTO_THREAD_lock_new();
149.       if (ret->lock == NULL) {
               ^
150.   #ifndef OPENSSL_NO_ENGINE
151.           ENGINE_finish(ret->engine);

crypto/dsa/dsa_lib.c:158:10: Taking true branch
156.       }
157.   
158.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
                ^
159.           DSA_free(ret);
160.           ret = NULL;

crypto/dsa/dsa_lib.c:158:39: Taking true branch
156.       }
157.   
158.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
                                             ^
159.           DSA_free(ret);
160.           ret = NULL;

crypto/dsa/dsa_lib.c:159:9: Skipping DSA_free(): empty list of specs
157.   
158.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
159.           DSA_free(ret);
               ^
160.           ret = NULL;
161.       }
