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


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

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

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

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

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

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

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

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

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       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 (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

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

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

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

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

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

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

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

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

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

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

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

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

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

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

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

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

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

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 (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}']