crypto/kdf/sskdf.c:127: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 92, column 11 is not reachable after line 127, column 5.
Showing all 66 steps of the trace


crypto/kdf/sskdf.c:70:1: start of procedure SSKDF_hash_kdm()
68.    * Section 4. One-Step Key Derivation using H(x) = hash(x)
69.    */
70. > static int SSKDF_hash_kdm(const EVP_MD *kdf_md,
71.                             const unsigned char *z, size_t z_len,
72.                             const unsigned char *info, size_t info_len,

crypto/kdf/sskdf.c:75:5: 
73.                             unsigned char *derived_key, size_t derived_key_len)
74.   {
75. >     int ret = 0, hlen;
76.       size_t counter, out_len, len = derived_key_len;
77.       unsigned char c[4];

crypto/kdf/sskdf.c:76:5: 
74.   {
75.       int ret = 0, hlen;
76. >     size_t counter, out_len, len = derived_key_len;
77.       unsigned char c[4];
78.       unsigned char mac[EVP_MAX_MD_SIZE];

crypto/kdf/sskdf.c:79:5: 
77.       unsigned char c[4];
78.       unsigned char mac[EVP_MAX_MD_SIZE];
79. >     unsigned char *out = derived_key;
80.       EVP_MD_CTX *ctx = NULL, *ctx_init = NULL;
81.   

crypto/kdf/sskdf.c:80:5: 
78.       unsigned char mac[EVP_MAX_MD_SIZE];
79.       unsigned char *out = derived_key;
80. >     EVP_MD_CTX *ctx = NULL, *ctx_init = NULL;
81.   
82.       if (z_len > SSKDF_MAX_INLEN || info_len > SSKDF_MAX_INLEN

crypto/kdf/sskdf.c:82:9: Taking false branch
80.       EVP_MD_CTX *ctx = NULL, *ctx_init = NULL;
81.   
82.       if (z_len > SSKDF_MAX_INLEN || info_len > SSKDF_MAX_INLEN
              ^
83.               || derived_key_len > SSKDF_MAX_INLEN
84.               || derived_key_len == 0)

crypto/kdf/sskdf.c:82:36: Taking false branch
80.       EVP_MD_CTX *ctx = NULL, *ctx_init = NULL;
81.   
82.       if (z_len > SSKDF_MAX_INLEN || info_len > SSKDF_MAX_INLEN
                                         ^
83.               || derived_key_len > SSKDF_MAX_INLEN
84.               || derived_key_len == 0)

crypto/kdf/sskdf.c:83:16: Taking false branch
81.   
82.       if (z_len > SSKDF_MAX_INLEN || info_len > SSKDF_MAX_INLEN
83.               || derived_key_len > SSKDF_MAX_INLEN
                     ^
84.               || derived_key_len == 0)
85.           return 0;

crypto/kdf/sskdf.c:84:16: Taking false branch
82.       if (z_len > SSKDF_MAX_INLEN || info_len > SSKDF_MAX_INLEN
83.               || derived_key_len > SSKDF_MAX_INLEN
84.               || derived_key_len == 0)
                     ^
85.           return 0;
86.   

crypto/kdf/sskdf.c:87:5: 
85.           return 0;
86.   
87. >     hlen = EVP_MD_size(kdf_md);
88.       if (hlen <= 0)
89.           return 0;

crypto/evp/evp_lib.c:313:1: start of procedure EVP_MD_size()
  311.   }
  312.   
  313. > int EVP_MD_size(const EVP_MD *md)
  314.   {
  315.       if (!md) {

crypto/evp/evp_lib.c:315:10: Taking false branch
  313.   int EVP_MD_size(const EVP_MD *md)
  314.   {
  315.       if (!md) {
                  ^
  316.           EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
  317.           return -1;

crypto/evp/evp_lib.c:319:5: 
  317.           return -1;
  318.       }
  319. >     return md->md_size;
  320.   }
  321.   

crypto/evp/evp_lib.c:320:1: return from a call to EVP_MD_size
  318.       }
  319.       return md->md_size;
  320. > }
  321.   
  322.   unsigned long EVP_MD_flags(const EVP_MD *md)

crypto/kdf/sskdf.c:88:9: Taking false branch
86.   
87.       hlen = EVP_MD_size(kdf_md);
88.       if (hlen <= 0)
              ^
89.           return 0;
90.       out_len = (size_t)hlen;

crypto/kdf/sskdf.c:90:5: 
88.       if (hlen <= 0)
89.           return 0;
90. >     out_len = (size_t)hlen;
91.   
92.       ctx = EVP_MD_CTX_create();

crypto/kdf/sskdf.c:92:5: 
90.       out_len = (size_t)hlen;
91.   
92. >     ctx = EVP_MD_CTX_create();
93.       ctx_init = EVP_MD_CTX_create();
94.       if (ctx == NULL || ctx_init == NULL)

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_new()
  47.   }
  48.   
  49. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:51:5: 
  49.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52.   }
  53.   

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       FAILTEST();

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

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

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

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

crypto/mem.c:204:9: Taking true branch
      202.   
      203.       FAILTEST();
      204.       if (allow_customize) {
                     ^
      205.           /*
      206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
      208.            * allocation.
      209.            */
      210. >         allow_customize = 0;
      211.       }
      212.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:221:5: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:221:19: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:222:5: 
      220.   #else
      221.       (void)(file); (void)(line);
      222. >     ret = malloc(num);
      223.   #endif
      224.   

crypto/mem.c:225:5: 
      223.   #endif
      224.   
      225. >     return ret;
      226.   }
      227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
      224.   
      225.       return ret;
      226. > }
      227.   
      228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking true branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:234:9: 
    232.       FAILTEST();
    233.       if (ret != NULL)
    234. >         memset(ret, 0, num);
    235.       return ret;
    236.   }

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:52:1: return from a call to EVP_MD_CTX_new
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52. > }
  53.   
  54.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/kdf/sskdf.c:93:5: 
91.   
92.       ctx = EVP_MD_CTX_create();
93. >     ctx_init = EVP_MD_CTX_create();
94.       if (ctx == NULL || ctx_init == NULL)
95.           goto end;

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_new()
  47.   }
  48.   
  49. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:51:5: 
  49.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52.   }
  53.   

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       FAILTEST();

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

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

crypto/mem.c:197:9: Taking true branch
      195.   
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      198.           return malloc_impl(num, file, line);
      199.   

crypto/mem.c:197:32: Taking true branch
      195.   
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                            ^
      198.           return malloc_impl(num, file, line);
      199.   

crypto/mem.c:198:9: Skipping __function_pointer__(): unresolved function pointer
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
      198.           return malloc_impl(num, file, line);
                     ^
      199.   
      200.       if (num == 0)

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
      224.   
      225.       return ret;
      226. > }
      227.   
      228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking false branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:52:1: return from a call to EVP_MD_CTX_new
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52. > }
  53.   
  54.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/kdf/sskdf.c:94:9: Taking false branch
92.       ctx = EVP_MD_CTX_create();
93.       ctx_init = EVP_MD_CTX_create();
94.       if (ctx == NULL || ctx_init == NULL)
              ^
95.           goto end;
96.   

crypto/kdf/sskdf.c:94:24: Taking true branch
92.       ctx = EVP_MD_CTX_create();
93.       ctx_init = EVP_MD_CTX_create();
94.       if (ctx == NULL || ctx_init == NULL)
                             ^
95.           goto end;
96.   

crypto/kdf/sskdf.c:126:1: 
124.       }
125.       ret = 1;
126. > end:
127.       EVP_MD_CTX_destroy(ctx);
128.       EVP_MD_CTX_destroy(ctx_init);

crypto/kdf/sskdf.c:127:5: 
125.       ret = 1;
126.   end:
127. >     EVP_MD_CTX_destroy(ctx);
128.       EVP_MD_CTX_destroy(ctx_init);
129.       OPENSSL_cleanse(mac, sizeof(mac));

crypto/evp/digest.c:54:1: start of procedure EVP_MD_CTX_free()
  52.   }
  53.   
  54. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  55.   {
  56.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:56:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  54.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  55.   {
  56.       EVP_MD_CTX_reset(ctx);
            ^
  57.       OPENSSL_free(ctx);
  58.   }

crypto/evp/digest.c:57:5: 
  55.   {
  56.       EVP_MD_CTX_reset(ctx);
  57. >     OPENSSL_free(ctx);
  58.   }
  59.   

crypto/mem.c:295:1: start of procedure CRYPTO_free()
    293.   }
    294.   
    295. > void CRYPTO_free(void *str, const char *file, int line)
    296.   {
    297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:298:30: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
                   ^
    300.           return;
    301.       }

crypto/mem.c:300:9: 
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
    300. >         return;
    301.       }
    302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
    312.       free(str);
    313.   #endif
    314. > }
    315.   
    316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:58:1: return from a call to EVP_MD_CTX_free
  56.       EVP_MD_CTX_reset(ctx);
  57.       OPENSSL_free(ctx);
  58. > }
  59.   
  60.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
