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

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

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

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

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

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

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

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

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

crypto/mem.c:195:1: return from a call to CRYPTO_malloc
  193.   
  194.       return ret;
  195. > }
  196.   
  197.   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:284:1: start of procedure CRYPTO_clear_free()
  282.   }
  283.   
  284. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  285.   {
  286.       if (str == NULL)

crypto/mem.c:286:9: Taking false branch
  284.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  285.   {
  286.       if (str == NULL)
                 ^
  287.           return;
  288.       if (num)

crypto/mem.c:288:9: Taking true branch
  286.       if (str == NULL)
  287.           return;
  288.       if (num)
                 ^
  289.           OPENSSL_cleanse(str, num);
  290.       CRYPTO_free(str, file, line);

crypto/mem.c:289:9: Skipping OPENSSL_cleanse(): method has no implementation
  287.           return;
  288.       if (num)
  289.           OPENSSL_cleanse(str, num);
                 ^
  290.       CRYPTO_free(str, file, line);
  291.   }

crypto/mem.c:290:5: 
  288.       if (num)
  289.           OPENSSL_cleanse(str, num);
  290. >     CRYPTO_free(str, file, line);
  291.   }

crypto/mem.c:264:1: start of procedure CRYPTO_free()
    262.   }
    263.   
    264. > void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:266:9: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:266:30: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:267:9: Skipping __function_pointer__(): unresolved function pointer
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
                   ^
    268.           return;
    269.       }

crypto/mem.c:268:9: 
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
    268. >         return;
    269.       }
    270.   

crypto/mem.c:282:1: return from a call to CRYPTO_free
    280.       free(str);
    281.   #endif
    282. > }
    283.   
    284.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

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

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    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    osslargused(file); osslargused(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    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}']