ssl/ssl_ciph.c:469: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 464, column 16 is not reachable after line 469, column 13.
Showing all 54 steps of the trace


ssl/ssl_ciph.c:455:1: start of procedure do_load_builtin_compressions()
453.   }
454.   
455. > DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions)
456.   {
457.       SSL_COMP *comp = NULL;

ssl/ssl_ciph.c:457:5: 
455.   DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions)
456.   {
457. >     SSL_COMP *comp = NULL;
458.       COMP_METHOD *method = COMP_zlib();
459.   

ssl/ssl_ciph.c:458:5: 
456.   {
457.       SSL_COMP *comp = NULL;
458. >     COMP_METHOD *method = COMP_zlib();
459.   
460.       CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);

crypto/comp/c_zlib.c:209:1: start of procedure COMP_zlib()
  207.   #endif
  208.   
  209. > COMP_METHOD *COMP_zlib(void)
  210.   {
  211.       COMP_METHOD *meth = &zlib_method_nozlib;

crypto/comp/c_zlib.c:211:5: 
  209.   COMP_METHOD *COMP_zlib(void)
  210.   {
  211. >     COMP_METHOD *meth = &zlib_method_nozlib;
  212.   
  213.   #ifdef ZLIB_SHARED

crypto/comp/c_zlib.c:259:5: 
  257.   #endif
  258.   
  259. >     return meth;
  260.   }
  261.   

crypto/comp/c_zlib.c:260:1: return from a call to COMP_zlib
  258.   
  259.       return meth;
  260. > }
  261.   
  262.   void comp_zlib_cleanup_int(void)

ssl/ssl_ciph.c:460:5: 
458.       COMP_METHOD *method = COMP_zlib();
459.   
460. >     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
461.       ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
462.   

crypto/mem_dbg.c:121:1: start of procedure CRYPTO_mem_ctrl()
  119.   #endif
  120.   
  121. > int CRYPTO_mem_ctrl(int mode)
  122.   {
  123.   #ifdef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem_dbg.c:124:5: 
  122.   {
  123.   #ifdef OPENSSL_NO_CRYPTO_MDEBUG
  124. >     return mode - mode;
  125.   #else
  126.       int ret = mh_mode;

crypto/mem_dbg.c:192:1: return from a call to CRYPTO_mem_ctrl
  190.       return ret;
  191.   #endif
  192. > }
  193.   
  194.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

ssl/ssl_ciph.c:461:5: 
459.   
460.       CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
461. >     ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
462.   
463.       if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {

include/openssl/ssl.h:904:1: start of procedure sk_SSL_COMP_new()
  902.    */
  903.   DEFINE_STACK_OF_CONST(SSL_CIPHER)
  904. > DEFINE_STACK_OF(SSL_COMP)
  905.   
  906.   /* compatibility */

crypto/stack/stack.c:117:1: start of procedure OPENSSL_sk_new()
    115.   }
    116.   
    117. > OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)
    118.   {
    119.       return OPENSSL_sk_new_reserve(c, 0);

crypto/stack/stack.c:119:5: Skipping OPENSSL_sk_new_reserve(): empty list of specs
    117.   OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)
    118.   {
    119.       return OPENSSL_sk_new_reserve(c, 0);
               ^
    120.   }
    121.   

crypto/stack/stack.c:120:1: return from a call to OPENSSL_sk_new
    118.   {
    119.       return OPENSSL_sk_new_reserve(c, 0);
    120. > }
    121.   
    122.   /*

include/openssl/ssl.h:904:1: return from a call to sk_SSL_COMP_new
  902.    */
  903.   DEFINE_STACK_OF_CONST(SSL_CIPHER)
  904. > DEFINE_STACK_OF(SSL_COMP)
  905.   
  906.   /* compatibility */

ssl/ssl_ciph.c:463:9: 
461.       ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
462.   
463. >     if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
464.           comp = OPENSSL_malloc(sizeof(*comp));
465.           if (comp != NULL) {

crypto/comp/comp_lib.c:36:1: start of procedure COMP_get_type()
  34.   }
  35.   
  36. > int COMP_get_type(const COMP_METHOD *meth)
  37.   {
  38.       return meth->type;

crypto/comp/comp_lib.c:38:5: 
  36.   int COMP_get_type(const COMP_METHOD *meth)
  37.   {
  38. >     return meth->type;
  39.   }
  40.   

crypto/comp/comp_lib.c:39:1: return from a call to COMP_get_type
  37.   {
  38.       return meth->type;
  39. > }
  40.   
  41.   const char *COMP_get_name(const COMP_METHOD *meth)

ssl/ssl_ciph.c:463:9: Taking true branch
461.       ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
462.   
463.       if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
               ^
464.           comp = OPENSSL_malloc(sizeof(*comp));
465.           if (comp != NULL) {

ssl/ssl_ciph.c:463:47: Taking true branch
461.       ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
462.   
463.       if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
                                                     ^
464.           comp = OPENSSL_malloc(sizeof(*comp));
465.           if (comp != NULL) {

ssl/ssl_ciph.c:464:9: 
462.   
463.       if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
464. >         comp = OPENSSL_malloc(sizeof(*comp));
465.           if (comp != NULL) {
466.               comp->method = method;

crypto/mem.c:189:1: start of procedure CRYPTO_malloc()
  187.   #endif
  188.   
  189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  190.   {
  191.       void *ret = NULL;

crypto/mem.c:191:5: 
  189.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  190.   {
  191. >     void *ret = NULL;
  192.   
  193.       INCREMENT(malloc_count);

crypto/mem.c:194:9: Taking false branch
  192.   
  193.       INCREMENT(malloc_count);
  194.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  195.           return malloc_impl(num, file, line);
  196.   

crypto/mem.c:197:9: Taking false branch
  195.           return malloc_impl(num, file, line);
  196.   
  197.       if (num == 0)
                 ^
  198.           return NULL;
  199.   

crypto/mem.c:201:5: 
  199.   
  200.       FAILTEST();
  201. >     allow_customize = 0;
  202.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  203.       if (call_malloc_debug) {

crypto/mem.c:211:5: 
  209.       }
  210.   #else
  211. >     (void)(file); (void)(line);
  212.       ret = malloc(num);
  213.   #endif

crypto/mem.c:211:19: 
  209.       }
  210.   #else
  211. >     (void)(file); (void)(line);
  212.       ret = malloc(num);
  213.   #endif

crypto/mem.c:212:5: 
  210.   #else
  211.       (void)(file); (void)(line);
  212. >     ret = malloc(num);
  213.   #endif
  214.   

crypto/mem.c:215:5: 
  213.   #endif
  214.   
  215. >     return ret;
  216.   }
  217.   

crypto/mem.c:216:1: return from a call to CRYPTO_malloc
  214.   
  215.       return ret;
  216. > }
  217.   
  218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

ssl/ssl_ciph.c:465:13: Taking true branch
463.       if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
464.           comp = OPENSSL_malloc(sizeof(*comp));
465.           if (comp != NULL) {
                   ^
466.               comp->method = method;
467.               comp->id = SSL_COMP_ZLIB_IDX;

ssl/ssl_ciph.c:466:13: 
464.           comp = OPENSSL_malloc(sizeof(*comp));
465.           if (comp != NULL) {
466. >             comp->method = method;
467.               comp->id = SSL_COMP_ZLIB_IDX;
468.               comp->name = COMP_get_name(method);

ssl/ssl_ciph.c:467:13: 
465.           if (comp != NULL) {
466.               comp->method = method;
467. >             comp->id = SSL_COMP_ZLIB_IDX;
468.               comp->name = COMP_get_name(method);
469.               sk_SSL_COMP_push(ssl_comp_methods, comp);

ssl/ssl_ciph.c:468:13: 
466.               comp->method = method;
467.               comp->id = SSL_COMP_ZLIB_IDX;
468. >             comp->name = COMP_get_name(method);
469.               sk_SSL_COMP_push(ssl_comp_methods, comp);
470.               sk_SSL_COMP_sort(ssl_comp_methods);

crypto/comp/comp_lib.c:41:1: start of procedure COMP_get_name()
  39.   }
  40.   
  41. > const char *COMP_get_name(const COMP_METHOD *meth)
  42.   {
  43.       return meth->name;

crypto/comp/comp_lib.c:43:5: 
  41.   const char *COMP_get_name(const COMP_METHOD *meth)
  42.   {
  43. >     return meth->name;
  44.   }
  45.   

crypto/comp/comp_lib.c:44:1: return from a call to COMP_get_name
  42.   {
  43.       return meth->name;
  44. > }
  45.   
  46.   void COMP_CTX_free(COMP_CTX *ctx)

ssl/ssl_ciph.c:469:13: 
467.               comp->id = SSL_COMP_ZLIB_IDX;
468.               comp->name = COMP_get_name(method);
469. >             sk_SSL_COMP_push(ssl_comp_methods, comp);
470.               sk_SSL_COMP_sort(ssl_comp_methods);
471.           }

include/openssl/ssl.h:904:1: start of procedure sk_SSL_COMP_push()
  902.    */
  903.   DEFINE_STACK_OF_CONST(SSL_CIPHER)
  904. > DEFINE_STACK_OF(SSL_COMP)
  905.   
  906.   /* compatibility */

crypto/stack/stack.c:321:1: start of procedure OPENSSL_sk_push()
    319.   }
    320.   
    321. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    322.   {
    323.       if (st == NULL)

crypto/stack/stack.c:323:9: Taking false branch
    321.   int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    322.   {
    323.       if (st == NULL)
                   ^
    324.           return -1;
    325.       return OPENSSL_sk_insert(st, data, st->num);

crypto/stack/stack.c:325:5: 
    323.       if (st == NULL)
    324.           return -1;
    325. >     return OPENSSL_sk_insert(st, data, st->num);
    326.   }
    327.   

crypto/stack/stack.c:232:1: start of procedure OPENSSL_sk_insert()
      230.   }
      231.   
      232. > int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)
      233.   {
      234.       if (st == NULL || st->num == max_nodes)

crypto/stack/stack.c:234:9: Taking false branch
      232.   int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)
      233.   {
      234.       if (st == NULL || st->num == max_nodes)
                     ^
      235.           return 0;
      236.   

crypto/stack/stack.c:234:23: Taking false branch
      232.   int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)
      233.   {
      234.       if (st == NULL || st->num == max_nodes)
                                   ^
      235.           return 0;
      236.   

crypto/stack/stack.c:237:10: Taking true branch
      235.           return 0;
      236.   
      237.       if (!sk_reserve(st, 1, 0))
                      ^
      238.           return 0;
      239.   

crypto/stack/stack.c:238:9: 
      236.   
      237.       if (!sk_reserve(st, 1, 0))
      238. >         return 0;
      239.   
      240.       if ((loc >= st->num) || (loc < 0)) {

crypto/stack/stack.c:250:1: return from a call to OPENSSL_sk_insert
      248.       st->sorted = 0;
      249.       return st->num;
      250. > }
      251.   
      252.   static ossl_inline void *internal_delete(OPENSSL_STACK *st, int loc)

crypto/stack/stack.c:326:1: return from a call to OPENSSL_sk_push
    324.           return -1;
    325.       return OPENSSL_sk_insert(st, data, st->num);
    326. > }
    327.   
    328.   int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data)

include/openssl/ssl.h:904:1: return from a call to sk_SSL_COMP_push
  902.    */
  903.   DEFINE_STACK_OF_CONST(SSL_CIPHER)
  904. > DEFINE_STACK_OF(SSL_COMP)
  905.   
  906.   /* compatibility */

DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions)
{
    SSL_COMP *comp = NULL;
    COMP_METHOD *method = COMP_zlib();
    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
    ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
    if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
        comp = OPENSSL_malloc(sizeof(*comp));
        if (comp != NULL) {
            comp->method = method;
            comp->id = SSL_COMP_ZLIB_IDX;
            comp->name = COMP_get_name(method);
            sk_SSL_COMP_push(ssl_comp_methods, comp);
            sk_SSL_COMP_sort(ssl_comp_methods);
        }
    }
    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
    return 1;
}
['DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions)', 'DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions)\n{\n    SSL_COMP *comp = NULL;\n    COMP_METHOD *method = COMP_zlib();\n    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);\n    ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);\n    if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {\n        comp = OPENSSL_malloc(sizeof(*comp));\n        if (comp != NULL) {\n            comp->method = method;\n            comp->id = SSL_COMP_ZLIB_IDX;\n            comp->name = COMP_get_name(method);\n            sk_SSL_COMP_push(ssl_comp_methods, comp);\n            sk_SSL_COMP_sort(ssl_comp_methods);\n        }\n    }\n    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);\n    return 1;\n}', 'COMP_METHOD *COMP_zlib(void)\n{\n    COMP_METHOD *meth = &zlib_method_nozlib;\n#ifdef ZLIB_SHARED\n# ifndef LIBZ\n#  if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)\n#   define LIBZ "ZLIB1"\n#  elif defined(OPENSSL_SYS_VMS)\n#   define LIBZ "LIBZ"\n#  else\n#   define LIBZ "z"\n#  endif\n# endif\n    if (!zlib_loaded) {\n        zlib_dso = DSO_load(NULL, LIBZ, NULL, 0);\n        if (zlib_dso != NULL) {\n            p_compress = (compress_ft) DSO_bind_func(zlib_dso, "compress");\n            p_inflateEnd\n                = (inflateEnd_ft) DSO_bind_func(zlib_dso, "inflateEnd");\n            p_inflate = (inflate_ft) DSO_bind_func(zlib_dso, "inflate");\n            p_inflateInit_\n                = (inflateInit__ft) DSO_bind_func(zlib_dso, "inflateInit_");\n            p_deflateEnd\n                = (deflateEnd_ft) DSO_bind_func(zlib_dso, "deflateEnd");\n            p_deflate = (deflate_ft) DSO_bind_func(zlib_dso, "deflate");\n            p_deflateInit_\n                = (deflateInit__ft) DSO_bind_func(zlib_dso, "deflateInit_");\n            p_zError = (zError__ft) DSO_bind_func(zlib_dso, "zError");\n            if (p_compress && p_inflateEnd && p_inflate\n                && p_inflateInit_ && p_deflateEnd\n                && p_deflate && p_deflateInit_ && p_zError)\n                zlib_loaded++;\n            if (!OPENSSL_init_crypto(OPENSSL_INIT_ZLIB, NULL)) {\n                comp_zlib_cleanup_int();\n                return meth;\n            }\n            if (zlib_loaded)\n                meth = &zlib_stateful_method;\n        }\n    }\n#endif\n#if defined(ZLIB)\n    meth = &zlib_stateful_method;\n#endif\n    return meth;\n}', 'int CRYPTO_mem_ctrl(int mode)\n{\n#ifdef OPENSSL_NO_CRYPTO_MDEBUG\n    return mode - mode;\n#else\n    int ret = mh_mode;\n    if (!RUN_ONCE(&memdbg_init, do_memdbg_init))\n        return -1;\n    CRYPTO_THREAD_write_lock(memdbg_lock);\n    switch (mode) {\n    default:\n        break;\n    case CRYPTO_MEM_CHECK_ON:\n        mh_mode = CRYPTO_MEM_CHECK_ON | CRYPTO_MEM_CHECK_ENABLE;\n        num_disable = 0;\n        break;\n    case CRYPTO_MEM_CHECK_OFF:\n        mh_mode = 0;\n        num_disable = 0;\n        break;\n    case CRYPTO_MEM_CHECK_DISABLE:\n        if (mh_mode & CRYPTO_MEM_CHECK_ON) {\n            CRYPTO_THREAD_ID cur = CRYPTO_THREAD_get_current_id();\n            if (!num_disable\n                || !CRYPTO_THREAD_compare_id(disabling_threadid, cur)) {\n                CRYPTO_THREAD_unlock(memdbg_lock);\n                CRYPTO_THREAD_write_lock(long_memdbg_lock);\n                CRYPTO_THREAD_write_lock(memdbg_lock);\n                mh_mode &= ~CRYPTO_MEM_CHECK_ENABLE;\n                disabling_threadid = cur;\n            }\n            num_disable++;\n        }\n        break;\n    case CRYPTO_MEM_CHECK_ENABLE:\n        if (mh_mode & CRYPTO_MEM_CHECK_ON) {\n            if (num_disable) {\n                num_disable--;\n                if (num_disable == 0) {\n                    mh_mode |= CRYPTO_MEM_CHECK_ENABLE;\n                    CRYPTO_THREAD_unlock(long_memdbg_lock);\n                }\n            }\n        }\n        break;\n    }\n    CRYPTO_THREAD_unlock(memdbg_lock);\n    return ret;\n#endif\n}', 'OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)\n{\n    return OPENSSL_sk_new_reserve(c, 0);\n}', 'int COMP_get_type(const COMP_METHOD *meth)\n{\n    return meth->type;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\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); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'const char *COMP_get_name(const COMP_METHOD *meth)\n{\n    return meth->name;\n}', 'int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)\n{\n    if (st == NULL)\n        return -1;\n    return OPENSSL_sk_insert(st, data, st->num);\n}', 'int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)\n{\n    if (st == NULL || st->num == max_nodes)\n        return 0;\n    if (!sk_reserve(st, 1, 0))\n        return 0;\n    if ((loc >= st->num) || (loc < 0)) {\n        st->data[st->num] = data;\n    } else {\n        memmove(&st->data[loc + 1], &st->data[loc],\n                sizeof(st->data[0]) * (st->num - loc));\n        st->data[loc] = data;\n    }\n    st->num++;\n    st->sorted = 0;\n    return st->num;\n}']