crypto/kdf/tls1_prf.c:264: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 259, column 15 is not reachable after line 264, column 13.
Showing all 41 steps of the trace


crypto/kdf/tls1_prf.c:246:1: start of procedure tls1_prf_alg()
244.   }
245.   
246. > static int tls1_prf_alg(const EVP_MD *md,
247.                           const unsigned char *sec, size_t slen,
248.                           const unsigned char *seed, size_t seed_len,

crypto/kdf/tls1_prf.c:252:9: 
250.   {
251.   
252. >     if (EVP_MD_type(md) == NID_md5_sha1) {
253.           size_t i;
254.           unsigned char *tmp;

crypto/evp/evp_lib.c:291:1: start of procedure EVP_MD_type()
  289.   }
  290.   
  291. > int EVP_MD_type(const EVP_MD *md)
  292.   {
  293.       return md->type;

crypto/evp/evp_lib.c:293:5: 
  291.   int EVP_MD_type(const EVP_MD *md)
  292.   {
  293. >     return md->type;
  294.   }
  295.   

crypto/evp/evp_lib.c:294:1: return from a call to EVP_MD_type
  292.   {
  293.       return md->type;
  294. > }
  295.   
  296.   int EVP_MD_pkey_type(const EVP_MD *md)

crypto/kdf/tls1_prf.c:252:9: Taking true branch
250.   {
251.   
252.       if (EVP_MD_type(md) == NID_md5_sha1) {
               ^
253.           size_t i;
254.           unsigned char *tmp;

crypto/kdf/tls1_prf.c:255:14: 
253.           size_t i;
254.           unsigned char *tmp;
255. >         if (!tls1_prf_P_hash(EVP_md5(), sec, slen/2 + (slen & 1),
256.                            seed, seed_len, out, olen))
257.               return 0;

crypto/evp/m_md5.c:51:1: start of procedure EVP_md5()
  49.   };
  50.   
  51. > const EVP_MD *EVP_md5(void)
  52.   {
  53.       return &md5_md;

crypto/evp/m_md5.c:53:5: 
  51.   const EVP_MD *EVP_md5(void)
  52.   {
  53. >     return &md5_md;
  54.   }
  55.   #endif

crypto/evp/m_md5.c:54:1: return from a call to EVP_md5
  52.   {
  53.       return &md5_md;
  54. > }
  55.   #endif

crypto/kdf/tls1_prf.c:255:14: Taking false branch
253.           size_t i;
254.           unsigned char *tmp;
255.           if (!tls1_prf_P_hash(EVP_md5(), sec, slen/2 + (slen & 1),
                    ^
256.                            seed, seed_len, out, olen))
257.               return 0;

crypto/kdf/tls1_prf.c:259:9: 
257.               return 0;
258.   
259. >         tmp = OPENSSL_malloc(olen);
260.           if (tmp == NULL)
261.               return 0;

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)

crypto/kdf/tls1_prf.c:260:13: Taking false branch
258.   
259.           tmp = OPENSSL_malloc(olen);
260.           if (tmp == NULL)
                   ^
261.               return 0;
262.           if (!tls1_prf_P_hash(EVP_sha1(), sec + slen/2, slen/2 + (slen & 1),

crypto/kdf/tls1_prf.c:262:14: 
260.           if (tmp == NULL)
261.               return 0;
262. >         if (!tls1_prf_P_hash(EVP_sha1(), sec + slen/2, slen/2 + (slen & 1),
263.                            seed, seed_len, tmp, olen)) {
264.               OPENSSL_clear_free(tmp, olen);

crypto/evp/m_sha1.c:108:1: start of procedure EVP_sha1()
  106.   };
  107.   
  108. > const EVP_MD *EVP_sha1(void)
  109.   {
  110.       return &sha1_md;

crypto/evp/m_sha1.c:110:5: 
  108.   const EVP_MD *EVP_sha1(void)
  109.   {
  110. >     return &sha1_md;
  111.   }
  112.   

crypto/evp/m_sha1.c:111:1: return from a call to EVP_sha1
  109.   {
  110.       return &sha1_md;
  111. > }
  112.   
  113.   static int init224(EVP_MD_CTX *ctx)

crypto/kdf/tls1_prf.c:262:14: Taking true branch
260.           if (tmp == NULL)
261.               return 0;
262.           if (!tls1_prf_P_hash(EVP_sha1(), sec + slen/2, slen/2 + (slen & 1),
                    ^
263.                            seed, seed_len, tmp, olen)) {
264.               OPENSSL_clear_free(tmp, olen);

crypto/kdf/tls1_prf.c:264:13: 
262.           if (!tls1_prf_P_hash(EVP_sha1(), sec + slen/2, slen/2 + (slen & 1),
263.                            seed, seed_len, tmp, olen)) {
264. >             OPENSSL_clear_free(tmp, olen);
265.               return 0;
266.           }

crypto/mem.c:307:1: start of procedure CRYPTO_clear_free()
  305.   }
  306.   
  307. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  308.   {
  309.       if (str == NULL)

crypto/mem.c:309:9: Taking false branch
  307.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  308.   {
  309.       if (str == NULL)
                 ^
  310.           return;
  311.       if (num)

crypto/mem.c:311:9: Taking true branch
  309.       if (str == NULL)
  310.           return;
  311.       if (num)
                 ^
  312.           OPENSSL_cleanse(str, num);
  313.       CRYPTO_free(str, file, line);

crypto/mem.c:312:9: Skipping OPENSSL_cleanse(): method has no implementation
  310.           return;
  311.       if (num)
  312.           OPENSSL_cleanse(str, num);
                 ^
  313.       CRYPTO_free(str, file, line);
  314.   }

crypto/mem.c:313:5: 
  311.       if (num)
  312.           OPENSSL_cleanse(str, num);
  313. >     CRYPTO_free(str, file, line);
  314.   }

crypto/mem.c:286:1: start of procedure CRYPTO_free()
    284.   }
    285.   
    286. > void CRYPTO_free(void *str, const char *file, int line)
    287.   {
    288.       INCREMENT(free_count);

crypto/mem.c:289:9: Taking true branch
    287.   {
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    290.           free_impl(str, file, line);
    291.           return;

crypto/mem.c:289:30: Taking true branch
    287.   {
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    290.           free_impl(str, file, line);
    291.           return;

crypto/mem.c:290:9: Skipping __function_pointer__(): unresolved function pointer
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    290.           free_impl(str, file, line);
                   ^
    291.           return;
    292.       }

crypto/mem.c:291:9: 
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    290.           free_impl(str, file, line);
    291. >         return;
    292.       }
    293.   

crypto/mem.c:305:1: return from a call to CRYPTO_free
    303.       free(str);
    304.   #endif
    305. > }
    306.   
    307.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/mem.c:314:1: return from a call to CRYPTO_clear_free
  312.           OPENSSL_cleanse(str, num);
  313.       CRYPTO_free(str, file, line);
  314. > }

static int tls1_prf_alg(const EVP_MD *md,
                        const unsigned char *sec, size_t slen,
                        const unsigned char *seed, size_t seed_len,
                        unsigned char *out, size_t olen)
{
    if (EVP_MD_type(md) == NID_md5_sha1) {
        size_t i;
        unsigned char *tmp;
        if (!tls1_prf_P_hash(EVP_md5(), sec, slen/2 + (slen & 1),
                         seed, seed_len, out, olen))
            return 0;
        tmp = OPENSSL_malloc(olen);
        if (tmp == NULL)
            return 0;
        if (!tls1_prf_P_hash(EVP_sha1(), sec + slen/2, slen/2 + (slen & 1),
                         seed, seed_len, tmp, olen)) {
            OPENSSL_clear_free(tmp, olen);
            return 0;
        }
        for (i = 0; i < olen; i++)
            out[i] ^= tmp[i];
        OPENSSL_clear_free(tmp, olen);
        return 1;
    }
    if (!tls1_prf_P_hash(md, sec, slen, seed, seed_len, out, olen))
        return 0;
    return 1;
}
['static int tls1_prf_alg(const EVP_MD *md,\n                        const unsigned char *sec, size_t slen,\n                        const unsigned char *seed, size_t seed_len,\n                        unsigned char *out, size_t olen)\n{\n    if (EVP_MD_type(md) == NID_md5_sha1) {\n        size_t i;\n        unsigned char *tmp;\n        if (!tls1_prf_P_hash(EVP_md5(), sec, slen/2 + (slen & 1),\n                         seed, seed_len, out, olen))\n            return 0;\n        tmp = OPENSSL_malloc(olen);\n        if (tmp == NULL)\n            return 0;\n        if (!tls1_prf_P_hash(EVP_sha1(), sec + slen/2, slen/2 + (slen & 1),\n                         seed, seed_len, tmp, olen)) {\n            OPENSSL_clear_free(tmp, olen);\n            return 0;\n        }\n        for (i = 0; i < olen; i++)\n            out[i] ^= tmp[i];\n        OPENSSL_clear_free(tmp, olen);\n        return 1;\n    }\n    if (!tls1_prf_P_hash(md, sec, slen, seed, seed_len, out, olen))\n        return 0;\n    return 1;\n}', 'int EVP_MD_type(const EVP_MD *md)\n{\n    return md->type;\n}', 'const EVP_MD *EVP_md5(void)\n{\n    return &md5_md;\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 EVP_MD *EVP_sha1(void)\n{\n    return &sha1_md;\n}', 'void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)\n{\n    if (str == NULL)\n        return;\n    if (num)\n        OPENSSL_cleanse(str, num);\n    CRYPTO_free(str, file, line);\n}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\n    INCREMENT(free_count);\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0, file, line);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1, file, line);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']