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 52 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:117:1: start of procedure CRYPTO_mem_ctrl()
  115.   #endif
  116.   
  117. > int CRYPTO_mem_ctrl(int mode)
  118.   {
  119.   #ifdef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem_dbg.c:120:5: 
  118.   {
  119.   #ifdef OPENSSL_NO_CRYPTO_MDEBUG
  120. >     return mode - mode;
  121.   #else
  122.       int ret = mh_mode;

crypto/mem_dbg.c:188:1: return from a call to CRYPTO_mem_ctrl
  186.       return ret;
  187.   #endif
  188. > }
  189.   
  190.   #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 */

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:170:1: start of procedure CRYPTO_malloc()
  168.   #endif
  169.   
  170. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  171.   {
  172.       void *ret = NULL;

crypto/mem.c:172:5: 
  170.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  171.   {
  172. >     void *ret = NULL;
  173.   
  174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:174:9: Taking false branch
  172.       void *ret = NULL;
  173.   
  174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  175.           return malloc_impl(num, file, line);
  176.   

crypto/mem.c:177:9: Taking false branch
  175.           return malloc_impl(num, file, line);
  176.   
  177.       if (num == 0)
                 ^
  178.           return NULL;
  179.   

crypto/mem.c:181:5: 
  179.   
  180.       FAILTEST();
  181. >     allow_customize = 0;
  182.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  183.       if (call_malloc_debug) {

crypto/mem.c:191:5: 
  189.       }
  190.   #else
  191. >     (void)(file); (void)(line);
  192.       ret = malloc(num);
  193.   #endif

crypto/mem.c:191:19: 
  189.       }
  190.   #else
  191. >     (void)(file); (void)(line);
  192.       ret = malloc(num);
  193.   #endif

crypto/mem.c:192:5: 
  190.   #else
  191.       (void)(file); (void)(line);
  192. >     ret = malloc(num);
  193.   #endif
  194.   

crypto/mem.c:195:5: 
  193.   #endif
  194.   
  195. >     return ret;
  196.   }
  197.   

crypto/mem.c:196:1: return from a call to CRYPTO_malloc
  194.   
  195.       return ret;
  196. > }
  197.   
  198.   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:307:1: start of procedure OPENSSL_sk_push()
    305.   }
    306.   
    307. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    308.   {
    309.       if (st == NULL)

crypto/stack/stack.c:309:9: Taking false branch
    307.   int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    308.   {
    309.       if (st == NULL)
                   ^
    310.           return -1;
    311.       return OPENSSL_sk_insert(st, data, st->num);

crypto/stack/stack.c:311:5: 
    309.       if (st == NULL)
    310.           return -1;
    311. >     return OPENSSL_sk_insert(st, data, st->num);
    312.   }
    313.   

crypto/stack/stack.c:222:1: start of procedure OPENSSL_sk_insert()
      220.   }
      221.   
      222. > int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)
      223.   {
      224.       if (st == NULL || st->num < 0 || st->num == max_nodes)

crypto/stack/stack.c:224:9: Taking false branch
      222.   int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)
      223.   {
      224.       if (st == NULL || st->num < 0 || st->num == max_nodes)
                     ^
      225.           return 0;
      226.   

crypto/stack/stack.c:224:23: Taking false branch
      222.   int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)
      223.   {
      224.       if (st == NULL || st->num < 0 || st->num == max_nodes)
                                   ^
      225.           return 0;
      226.   

crypto/stack/stack.c:224:38: Taking false branch
      222.   int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)
      223.   {
      224.       if (st == NULL || st->num < 0 || st->num == max_nodes)
                                                  ^
      225.           return 0;
      226.   

crypto/stack/stack.c:227:10: Taking true branch
      225.           return 0;
      226.   
      227.       if (!sk_reserve(st, 1, 0))
                      ^
      228.           return 0;
      229.   

crypto/stack/stack.c:228:9: 
      226.   
      227.       if (!sk_reserve(st, 1, 0))
      228. >         return 0;
      229.   
      230.       if ((loc >= st->num) || (loc < 0)) {

crypto/stack/stack.c:240:1: return from a call to OPENSSL_sk_insert
      238.       st->sorted = 0;
      239.       return st->num;
      240. > }
      241.   
      242.   static ossl_inline void *internal_delete(OPENSSL_STACK *st, int loc)

crypto/stack/stack.c:312:1: return from a call to OPENSSL_sk_push
    310.           return -1;
    311.       return OPENSSL_sk_insert(st, data, st->num);
    312. > }
    313.   
    314.   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(malloc_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(malloc_lock);\n                CRYPTO_THREAD_write_lock(long_malloc_lock);\n                CRYPTO_THREAD_write_lock(malloc_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_malloc_lock);\n                }\n            }\n        }\n        break;\n    }\n    CRYPTO_THREAD_unlock(malloc_lock);\n    return ret;\n#endif\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    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 < 0 || 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}']