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


crypto/init.c:510:1: start of procedure ossl_init_thread_start()
508.   }
509.   
510. > int ossl_init_thread_start(uint64_t opts)
511.   {
512.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);

crypto/init.c:512:5: 
510.   int ossl_init_thread_start(uint64_t opts)
511.   {
512. >     struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
513.   
514.       if (locals == NULL)

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

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

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

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

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

crypto/mem.c:159:1: start of procedure CRYPTO_zalloc()
    157.   }
    158.   
    159. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    160.   {
    161.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:161:5: 
    159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    160.   {
    161. >     void *ret = CRYPTO_malloc(num, file, line);
    162.   
    163.       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. >     (void)file;
      140.       (void)line;
      141.       ret = malloc(num);

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

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

crypto/mem.c:156:5: 
      154.   #endif
      155.   
      156. >     return ret;
      157.   }
      158.   

crypto/mem.c:157:1: return from a call to CRYPTO_malloc
      155.   
      156.       return ret;
      157. > }
      158.   
      159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:163:9: Taking true branch
    161.       void *ret = CRYPTO_malloc(num, file, line);
    162.   
    163.       if (ret != NULL)
                   ^
    164.           memset(ret, 0, num);
    165.       return ret;

crypto/mem.c:164:9: 
    162.   
    163.       if (ret != NULL)
    164. >         memset(ret, 0, num);
    165.       return ret;
    166.   }

crypto/mem.c:165:5: 
    163.       if (ret != NULL)
    164.           memset(ret, 0, num);
    165. >     return ret;
    166.   }
    167.   

crypto/mem.c:166:1: return from a call to CRYPTO_zalloc
    164.           memset(ret, 0, num);
    165.       return ret;
    166. > }
    167.   
    168.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/init.c:246:9: Skipping pthread_setspecific(): method has no implementation
  244.       if (local == NULL && alloc) {
  245.           local = OPENSSL_zalloc(sizeof *local);
  246.           pthread_setspecific(threadstopkey, local);
                 ^
  247.       }
  248.       if (!alloc) {

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

crypto/init.c:252:5: 
  250.       }
  251.   
  252. >     return local;
  253.   }
  254.   

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

crypto/init.c:514:9: Taking false branch
512.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
513.   
514.       if (locals == NULL)
               ^
515.           return 0;
516.   

crypto/init.c:517:9: Taking false branch
515.           return 0;
516.   
517.       if (opts & OPENSSL_INIT_THREAD_ASYNC) {
               ^
518.   #ifdef OPENSSL_INIT_DEBUG
519.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

crypto/init.c:525:9: Taking true branch
523.       }
524.   
525.       if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
               ^
526.   #ifdef OPENSSL_INIT_DEBUG
527.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

crypto/init.c:530:9: 
528.                           "marking thread for err_state\n");
529.   #endif
530. >         locals->err_state = 1;
531.       }
532.   

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    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']