crypto/dso/dso_lib.c:96: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_THREAD_lock_new()` at line 89, column 17 is not reachable after line 96, column 39.
Showing all 55 steps of the trace


crypto/dso/dso_lib.c:63:1: start of procedure DSO_new_method()
61.   static DSO_METHOD *default_DSO_meth = NULL;
62.   
63. > static DSO *DSO_new_method(DSO_METHOD *meth)
64.   {
65.       DSO *ret;

crypto/dso/dso_lib.c:67:9: Taking false branch
65.       DSO *ret;
66.   
67.       if (default_DSO_meth == NULL) {
              ^
68.           /*
69.            * We default to DSO_METH_openssl() which in turn defaults to

crypto/dso/dso_lib.c:75:5: 
73.           default_DSO_meth = DSO_METHOD_openssl();
74.       }
75. >     ret = OPENSSL_zalloc(sizeof(*ret));
76.       if (ret == NULL) {
77.           DSOerr(DSO_F_DSO_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/dso/dso_lib.c:76:9: Taking false branch
74.       }
75.       ret = OPENSSL_zalloc(sizeof(*ret));
76.       if (ret == NULL) {
              ^
77.           DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
78.           return (NULL);

crypto/dso/dso_lib.c:80:5: 
78.           return (NULL);
79.       }
80. >     ret->meth_data = sk_void_new_null();
81.       if (ret->meth_data == NULL) {
82.           /* sk_new doesn't generate any errors so we do */

include/openssl/crypto.h:203:1: start of procedure sk_void_new_null()
  201.       STACK_OF(void) *sk;
  202.   };
  203. > DEFINE_STACK_OF(void)
  204.   
  205.   /*

crypto/stack/stack.c:144:1: start of procedure sk_new_null()
    142.   }
    143.   
    144. > _STACK *sk_new_null(void)
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:146:5: Skipping sk_new(): empty list of specs
    144.   _STACK *sk_new_null(void)
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);
               ^
    147.   }
    148.   

crypto/stack/stack.c:147:1: return from a call to sk_new_null
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);
    147. > }
    148.   
    149.   _STACK *sk_new(int (*c) (const void *, const void *))

include/openssl/crypto.h:203:1: return from a call to sk_void_new_null
  201.       STACK_OF(void) *sk;
  202.   };
  203. > DEFINE_STACK_OF(void)
  204.   
  205.   /*

crypto/dso/dso_lib.c:81:9: Taking false branch
79.       }
80.       ret->meth_data = sk_void_new_null();
81.       if (ret->meth_data == NULL) {
              ^
82.           /* sk_new doesn't generate any errors so we do */
83.           DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);

crypto/dso/dso_lib.c:87:5: 
85.           return (NULL);
86.       }
87. >     ret->meth = default_DSO_meth;
88.       ret->references = 1;
89.       ret->lock = CRYPTO_THREAD_lock_new();

crypto/dso/dso_lib.c:88:5: 
86.       }
87.       ret->meth = default_DSO_meth;
88. >     ret->references = 1;
89.       ret->lock = CRYPTO_THREAD_lock_new();
90.       if (ret->lock == NULL) {

crypto/dso/dso_lib.c:89:5: 
87.       ret->meth = default_DSO_meth;
88.       ret->references = 1;
89. >     ret->lock = CRYPTO_THREAD_lock_new();
90.       if (ret->lock == NULL) {
91.           sk_void_free(ret->meth_data);

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/dso/dso_lib.c:90:9: Taking false branch
88.       ret->references = 1;
89.       ret->lock = CRYPTO_THREAD_lock_new();
90.       if (ret->lock == NULL) {
              ^
91.           sk_void_free(ret->meth_data);
92.           OPENSSL_free(ret);

crypto/dso/dso_lib.c:96:10: Taking true branch
94.       }
95.   
96.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
               ^
97.           DSO_free(ret);
98.           ret = NULL;

crypto/dso/dso_lib.c:96:39: Skipping __function_pointer__(): unresolved function pointer
94.       }
95.   
96.       if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
                                            ^
97.           DSO_free(ret);
98.           ret = NULL;

static DSO *DSO_new_method(DSO_METHOD *meth)
{
    DSO *ret;
    if (default_DSO_meth == NULL) {
        default_DSO_meth = DSO_METHOD_openssl();
    }
    ret = OPENSSL_zalloc(sizeof(*ret));
    if (ret == NULL) {
        DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
        return (NULL);
    }
    ret->meth_data = sk_void_new_null();
    if (ret->meth_data == NULL) {
        DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
        OPENSSL_free(ret);
        return (NULL);
    }
    ret->meth = default_DSO_meth;
    ret->references = 1;
    ret->lock = CRYPTO_THREAD_lock_new();
    if (ret->lock == NULL) {
        sk_void_free(ret->meth_data);
        OPENSSL_free(ret);
        return NULL;
    }
    if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
        DSO_free(ret);
        ret = NULL;
    }
    return ret;
}
['static DSO *DSO_new_method(DSO_METHOD *meth)\n{\n    DSO *ret;\n    if (default_DSO_meth == NULL) {\n        default_DSO_meth = DSO_METHOD_openssl();\n    }\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->meth_data = sk_void_new_null();\n    if (ret->meth_data == NULL) {\n        DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);\n        OPENSSL_free(ret);\n        return (NULL);\n    }\n    ret->meth = default_DSO_meth;\n    ret->references = 1;\n    ret->lock = CRYPTO_THREAD_lock_new();\n    if (ret->lock == NULL) {\n        sk_void_free(ret->meth_data);\n        OPENSSL_free(ret);\n        return NULL;\n    }\n    if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {\n        DSO_free(ret);\n        ret = NULL;\n    }\n    return ret;\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}', 'DEFINE_STACK_OF(void)', '_STACK *sk_new_null(void)\n{\n    return sk_new((int (*)(const void *, const void *))0);\n}', 'CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)\n{\n    CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));\n    if (lock == NULL)\n        return NULL;\n    if (pthread_rwlock_init(lock, NULL) != 0) {\n        OPENSSL_free(lock);\n        return NULL;\n    }\n    return lock;\n}']