crypto/hmac/hmac.c:139: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_zalloc()` at line 135, column 21 is not reachable after line 139, column 13.
Showing all 45 steps of the trace


crypto/hmac/hmac.c:133:1: start of procedure HMAC_CTX_new()
131.   }
132.   
133. > HMAC_CTX *HMAC_CTX_new(void)
134.   {
135.       HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));

crypto/hmac/hmac.c:135:5: 
133.   HMAC_CTX *HMAC_CTX_new(void)
134.   {
135. >     HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));
136.   
137.       if (ctx != NULL) {

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.   #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)

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/hmac/hmac.c:137:9: Taking true branch
135.       HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));
136.   
137.       if (ctx != NULL) {
               ^
138.           if (!HMAC_CTX_reset(ctx)) {
139.               HMAC_CTX_free(ctx);

crypto/hmac/hmac.c:138:14: 
136.   
137.       if (ctx != NULL) {
138. >         if (!HMAC_CTX_reset(ctx)) {
139.               HMAC_CTX_free(ctx);
140.               return NULL;

crypto/hmac/hmac.c:184:1: start of procedure HMAC_CTX_reset()
  182.   }
  183.   
  184. > int HMAC_CTX_reset(HMAC_CTX *ctx)
  185.   {
  186.       hmac_ctx_cleanup(ctx);

crypto/hmac/hmac.c:186:5: 
  184.   int HMAC_CTX_reset(HMAC_CTX *ctx)
  185.   {
  186. >     hmac_ctx_cleanup(ctx);
  187.       if (!hmac_ctx_alloc_mds(ctx)) {
  188.           hmac_ctx_cleanup(ctx);

crypto/hmac/hmac.c:146:1: start of procedure hmac_ctx_cleanup()
    144.   }
    145.   
    146. > static void hmac_ctx_cleanup(HMAC_CTX *ctx)
    147.   {
    148.       EVP_MD_CTX_reset(ctx->i_ctx);

crypto/hmac/hmac.c:148:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    146.   static void hmac_ctx_cleanup(HMAC_CTX *ctx)
    147.   {
    148.       EVP_MD_CTX_reset(ctx->i_ctx);
               ^
    149.       EVP_MD_CTX_reset(ctx->o_ctx);
    150.       EVP_MD_CTX_reset(ctx->md_ctx);

crypto/hmac/hmac.c:149:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    147.   {
    148.       EVP_MD_CTX_reset(ctx->i_ctx);
    149.       EVP_MD_CTX_reset(ctx->o_ctx);
               ^
    150.       EVP_MD_CTX_reset(ctx->md_ctx);
    151.       ctx->md = NULL;

crypto/hmac/hmac.c:150:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    148.       EVP_MD_CTX_reset(ctx->i_ctx);
    149.       EVP_MD_CTX_reset(ctx->o_ctx);
    150.       EVP_MD_CTX_reset(ctx->md_ctx);
               ^
    151.       ctx->md = NULL;
    152.       ctx->key_length = 0;

crypto/hmac/hmac.c:151:5: 
    149.       EVP_MD_CTX_reset(ctx->o_ctx);
    150.       EVP_MD_CTX_reset(ctx->md_ctx);
    151. >     ctx->md = NULL;
    152.       ctx->key_length = 0;
    153.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));

crypto/hmac/hmac.c:152:5: 
    150.       EVP_MD_CTX_reset(ctx->md_ctx);
    151.       ctx->md = NULL;
    152. >     ctx->key_length = 0;
    153.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
    154.   }

crypto/hmac/hmac.c:153:5: Skipping OPENSSL_cleanse(): method has no implementation
    151.       ctx->md = NULL;
    152.       ctx->key_length = 0;
    153.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
               ^
    154.   }
    155.   

crypto/hmac/hmac.c:154:1: return from a call to hmac_ctx_cleanup
    152.       ctx->key_length = 0;
    153.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
    154. > }
    155.   
    156.   void HMAC_CTX_free(HMAC_CTX *ctx)

crypto/hmac/hmac.c:187:10: Taking true branch
  185.   {
  186.       hmac_ctx_cleanup(ctx);
  187.       if (!hmac_ctx_alloc_mds(ctx)) {
                  ^
  188.           hmac_ctx_cleanup(ctx);
  189.           return 0;

crypto/hmac/hmac.c:188:9: 
  186.       hmac_ctx_cleanup(ctx);
  187.       if (!hmac_ctx_alloc_mds(ctx)) {
  188. >         hmac_ctx_cleanup(ctx);
  189.           return 0;
  190.       }

crypto/hmac/hmac.c:146:1: start of procedure hmac_ctx_cleanup()
    144.   }
    145.   
    146. > static void hmac_ctx_cleanup(HMAC_CTX *ctx)
    147.   {
    148.       EVP_MD_CTX_reset(ctx->i_ctx);

crypto/hmac/hmac.c:148:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    146.   static void hmac_ctx_cleanup(HMAC_CTX *ctx)
    147.   {
    148.       EVP_MD_CTX_reset(ctx->i_ctx);
               ^
    149.       EVP_MD_CTX_reset(ctx->o_ctx);
    150.       EVP_MD_CTX_reset(ctx->md_ctx);

crypto/hmac/hmac.c:149:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    147.   {
    148.       EVP_MD_CTX_reset(ctx->i_ctx);
    149.       EVP_MD_CTX_reset(ctx->o_ctx);
               ^
    150.       EVP_MD_CTX_reset(ctx->md_ctx);
    151.       ctx->md = NULL;

crypto/hmac/hmac.c:150:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    148.       EVP_MD_CTX_reset(ctx->i_ctx);
    149.       EVP_MD_CTX_reset(ctx->o_ctx);
    150.       EVP_MD_CTX_reset(ctx->md_ctx);
               ^
    151.       ctx->md = NULL;
    152.       ctx->key_length = 0;

crypto/hmac/hmac.c:151:5: 
    149.       EVP_MD_CTX_reset(ctx->o_ctx);
    150.       EVP_MD_CTX_reset(ctx->md_ctx);
    151. >     ctx->md = NULL;
    152.       ctx->key_length = 0;
    153.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));

crypto/hmac/hmac.c:152:5: 
    150.       EVP_MD_CTX_reset(ctx->md_ctx);
    151.       ctx->md = NULL;
    152. >     ctx->key_length = 0;
    153.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
    154.   }

crypto/hmac/hmac.c:153:5: Skipping OPENSSL_cleanse(): method has no implementation
    151.       ctx->md = NULL;
    152.       ctx->key_length = 0;
    153.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
               ^
    154.   }
    155.   

crypto/hmac/hmac.c:154:1: return from a call to hmac_ctx_cleanup
    152.       ctx->key_length = 0;
    153.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
    154. > }
    155.   
    156.   void HMAC_CTX_free(HMAC_CTX *ctx)

crypto/hmac/hmac.c:189:9: 
  187.       if (!hmac_ctx_alloc_mds(ctx)) {
  188.           hmac_ctx_cleanup(ctx);
  189. >         return 0;
  190.       }
  191.       return 1;

crypto/hmac/hmac.c:192:1: return from a call to HMAC_CTX_reset
  190.       }
  191.       return 1;
  192. > }
  193.   
  194.   int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)

crypto/hmac/hmac.c:138:14: Taking true branch
136.   
137.       if (ctx != NULL) {
138.           if (!HMAC_CTX_reset(ctx)) {
                    ^
139.               HMAC_CTX_free(ctx);
140.               return NULL;

crypto/hmac/hmac.c:139:13: Skipping HMAC_CTX_free(): empty list of specs
137.       if (ctx != NULL) {
138.           if (!HMAC_CTX_reset(ctx)) {
139.               HMAC_CTX_free(ctx);
                   ^
140.               return NULL;
141.           }
