crypto/init.c:544: error: MEMORY_LEAK
  memory dynamically allocated to `locals` by call to `ossl_init_get_thread_local()` at line 531, column 44 is not reachable after line 544, column 9.
Showing all 30 steps of the trace


crypto/init.c:529:1: start of procedure ossl_init_thread_start()
527.   }
528.   
529. > int ossl_init_thread_start(uint64_t opts)
530.   {
531.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);

crypto/init.c:531:5: 
529.   int ossl_init_thread_start(uint64_t opts)
530.   {
531. >     struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
532.   
533.       if (locals == NULL)

crypto/init.c:242:1: start of procedure ossl_init_get_thread_local()
  240.   }
  241.   
  242. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
  243.   {
  244.       struct thread_local_inits_st *local = pthread_getspecific(threadstopkey);

crypto/init.c:244:5: Skipping pthread_getspecific(): method has no implementation
  242.   static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
  243.   {
  244.       struct thread_local_inits_st *local = pthread_getspecific(threadstopkey);
             ^
  245.   
  246.       if (local == NULL && alloc) {

crypto/init.c:246:9: Taking true branch
  244.       struct thread_local_inits_st *local = pthread_getspecific(threadstopkey);
  245.   
  246.       if (local == NULL && alloc) {
                 ^
  247.           local = OPENSSL_zalloc(sizeof *local);
  248.           pthread_setspecific(threadstopkey, local);

crypto/init.c:246:26: Taking true branch
  244.       struct thread_local_inits_st *local = pthread_getspecific(threadstopkey);
  245.   
  246.       if (local == NULL && alloc) {
                                  ^
  247.           local = OPENSSL_zalloc(sizeof *local);
  248.           pthread_setspecific(threadstopkey, local);

crypto/init.c:247:9: 
  245.   
  246.       if (local == NULL && alloc) {
  247. >         local = OPENSSL_zalloc(sizeof *local);
  248.           pthread_setspecific(threadstopkey, local);
  249.       }

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/init.c:248:9: Skipping pthread_setspecific(): method has no implementation
  246.       if (local == NULL && alloc) {
  247.           local = OPENSSL_zalloc(sizeof *local);
  248.           pthread_setspecific(threadstopkey, local);
                 ^
  249.       }
  250.       if (!alloc) {

crypto/init.c:250:10: Taking false branch
  248.           pthread_setspecific(threadstopkey, local);
  249.       }
  250.       if (!alloc) {
                  ^
  251.           pthread_setspecific(threadstopkey, NULL);
  252.       }

crypto/init.c:254:5: 
  252.       }
  253.   
  254. >     return local;
  255.   }
  256.   

crypto/init.c:255:1: return from a call to ossl_init_get_thread_local
  253.   
  254.       return local;
  255. > }
  256.   
  257.   #endif

crypto/init.c:533:9: Taking false branch
531.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
532.   
533.       if (locals == NULL)
               ^
534.           return 0;
535.   

crypto/init.c:536:9: Taking false branch
534.           return 0;
535.   
536.       if (opts & OPENSSL_INIT_THREAD_ASYNC) {
               ^
537.   #ifdef OPENSSL_INIT_DEBUG
538.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

crypto/init.c:544:9: Taking false branch
542.       }
543.   
544.       if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
               ^
545.   #ifdef OPENSSL_INIT_DEBUG
546.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

int ossl_init_thread_start(uint64_t opts)
{
    struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
    if (locals == NULL)
        return 0;
    if (opts & OPENSSL_INIT_THREAD_ASYNC) {
#ifdef OPENSSL_INIT_DEBUG
        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
                        "marking thread for async\n");
#endif
        locals->async = 1;
    }
    if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
#ifdef OPENSSL_INIT_DEBUG
        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
                        "marking thread for err_state\n");
#endif
        locals->err_state = 1;
    }
    return 1;
}
['int ossl_init_thread_start(uint64_t opts)\n{\n    struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);\n    if (locals == NULL)\n        return 0;\n    if (opts & OPENSSL_INIT_THREAD_ASYNC) {\n#ifdef OPENSSL_INIT_DEBUG\n        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "\n                        "marking thread for async\\n");\n#endif\n        locals->async = 1;\n    }\n    if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {\n#ifdef OPENSSL_INIT_DEBUG\n        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "\n                        "marking thread for err_state\\n");\n#endif\n        locals->err_state = 1;\n    }\n    return 1;\n}', 'static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)\n{\n    struct thread_local_inits_st *local = pthread_getspecific(threadstopkey);\n    if (local == NULL && alloc) {\n        local = OPENSSL_zalloc(sizeof *local);\n        pthread_setspecific(threadstopkey, local);\n    }\n    if (!alloc) {\n        pthread_setspecific(threadstopkey, NULL);\n    }\n    return local;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}']