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


crypto/hmac/hmac.c:127:1: start of procedure HMAC_CTX_new()
125.   }
126.   
127. > HMAC_CTX *HMAC_CTX_new(void)
128.   {
129.       HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));

crypto/hmac/hmac.c:129:5: 
127.   HMAC_CTX *HMAC_CTX_new(void)
128.   {
129. >     HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));
130.   
131.       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.   #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/hmac/hmac.c:131:9: Taking true branch
129.       HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));
130.   
131.       if (ctx != NULL) {
               ^
132.           if (!HMAC_CTX_reset(ctx)) {
133.               HMAC_CTX_free(ctx);

crypto/hmac/hmac.c:132:14: 
130.   
131.       if (ctx != NULL) {
132. >         if (!HMAC_CTX_reset(ctx)) {
133.               HMAC_CTX_free(ctx);
134.               return NULL;

crypto/hmac/hmac.c:178:1: start of procedure HMAC_CTX_reset()
  176.   }
  177.   
  178. > int HMAC_CTX_reset(HMAC_CTX *ctx)
  179.   {
  180.       hmac_ctx_cleanup(ctx);

crypto/hmac/hmac.c:180:5: 
  178.   int HMAC_CTX_reset(HMAC_CTX *ctx)
  179.   {
  180. >     hmac_ctx_cleanup(ctx);
  181.       if (!hmac_ctx_alloc_mds(ctx)) {
  182.           hmac_ctx_cleanup(ctx);

crypto/hmac/hmac.c:140:1: start of procedure hmac_ctx_cleanup()
    138.   }
    139.   
    140. > static void hmac_ctx_cleanup(HMAC_CTX *ctx)
    141.   {
    142.       EVP_MD_CTX_reset(ctx->i_ctx);

crypto/hmac/hmac.c:142:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    140.   static void hmac_ctx_cleanup(HMAC_CTX *ctx)
    141.   {
    142.       EVP_MD_CTX_reset(ctx->i_ctx);
               ^
    143.       EVP_MD_CTX_reset(ctx->o_ctx);
    144.       EVP_MD_CTX_reset(ctx->md_ctx);

crypto/hmac/hmac.c:143:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    141.   {
    142.       EVP_MD_CTX_reset(ctx->i_ctx);
    143.       EVP_MD_CTX_reset(ctx->o_ctx);
               ^
    144.       EVP_MD_CTX_reset(ctx->md_ctx);
    145.       ctx->md = NULL;

crypto/hmac/hmac.c:144:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    142.       EVP_MD_CTX_reset(ctx->i_ctx);
    143.       EVP_MD_CTX_reset(ctx->o_ctx);
    144.       EVP_MD_CTX_reset(ctx->md_ctx);
               ^
    145.       ctx->md = NULL;
    146.       ctx->key_length = 0;

crypto/hmac/hmac.c:145:5: 
    143.       EVP_MD_CTX_reset(ctx->o_ctx);
    144.       EVP_MD_CTX_reset(ctx->md_ctx);
    145. >     ctx->md = NULL;
    146.       ctx->key_length = 0;
    147.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));

crypto/hmac/hmac.c:146:5: 
    144.       EVP_MD_CTX_reset(ctx->md_ctx);
    145.       ctx->md = NULL;
    146. >     ctx->key_length = 0;
    147.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
    148.   }

crypto/hmac/hmac.c:147:5: Skipping OPENSSL_cleanse(): method has no implementation
    145.       ctx->md = NULL;
    146.       ctx->key_length = 0;
    147.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
               ^
    148.   }
    149.   

crypto/hmac/hmac.c:148:1: return from a call to hmac_ctx_cleanup
    146.       ctx->key_length = 0;
    147.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
    148. > }
    149.   
    150.   void HMAC_CTX_free(HMAC_CTX *ctx)

crypto/hmac/hmac.c:181:10: Taking true branch
  179.   {
  180.       hmac_ctx_cleanup(ctx);
  181.       if (!hmac_ctx_alloc_mds(ctx)) {
                  ^
  182.           hmac_ctx_cleanup(ctx);
  183.           return 0;

crypto/hmac/hmac.c:182:9: 
  180.       hmac_ctx_cleanup(ctx);
  181.       if (!hmac_ctx_alloc_mds(ctx)) {
  182. >         hmac_ctx_cleanup(ctx);
  183.           return 0;
  184.       }

crypto/hmac/hmac.c:140:1: start of procedure hmac_ctx_cleanup()
    138.   }
    139.   
    140. > static void hmac_ctx_cleanup(HMAC_CTX *ctx)
    141.   {
    142.       EVP_MD_CTX_reset(ctx->i_ctx);

crypto/hmac/hmac.c:142:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    140.   static void hmac_ctx_cleanup(HMAC_CTX *ctx)
    141.   {
    142.       EVP_MD_CTX_reset(ctx->i_ctx);
               ^
    143.       EVP_MD_CTX_reset(ctx->o_ctx);
    144.       EVP_MD_CTX_reset(ctx->md_ctx);

crypto/hmac/hmac.c:143:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    141.   {
    142.       EVP_MD_CTX_reset(ctx->i_ctx);
    143.       EVP_MD_CTX_reset(ctx->o_ctx);
               ^
    144.       EVP_MD_CTX_reset(ctx->md_ctx);
    145.       ctx->md = NULL;

crypto/hmac/hmac.c:144:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    142.       EVP_MD_CTX_reset(ctx->i_ctx);
    143.       EVP_MD_CTX_reset(ctx->o_ctx);
    144.       EVP_MD_CTX_reset(ctx->md_ctx);
               ^
    145.       ctx->md = NULL;
    146.       ctx->key_length = 0;

crypto/hmac/hmac.c:145:5: 
    143.       EVP_MD_CTX_reset(ctx->o_ctx);
    144.       EVP_MD_CTX_reset(ctx->md_ctx);
    145. >     ctx->md = NULL;
    146.       ctx->key_length = 0;
    147.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));

crypto/hmac/hmac.c:146:5: 
    144.       EVP_MD_CTX_reset(ctx->md_ctx);
    145.       ctx->md = NULL;
    146. >     ctx->key_length = 0;
    147.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
    148.   }

crypto/hmac/hmac.c:147:5: Skipping OPENSSL_cleanse(): method has no implementation
    145.       ctx->md = NULL;
    146.       ctx->key_length = 0;
    147.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
               ^
    148.   }
    149.   

crypto/hmac/hmac.c:148:1: return from a call to hmac_ctx_cleanup
    146.       ctx->key_length = 0;
    147.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
    148. > }
    149.   
    150.   void HMAC_CTX_free(HMAC_CTX *ctx)

crypto/hmac/hmac.c:183:9: 
  181.       if (!hmac_ctx_alloc_mds(ctx)) {
  182.           hmac_ctx_cleanup(ctx);
  183. >         return 0;
  184.       }
  185.       return 1;

crypto/hmac/hmac.c:186:1: return from a call to HMAC_CTX_reset
  184.       }
  185.       return 1;
  186. > }
  187.   
  188.   int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)

crypto/hmac/hmac.c:132:14: Taking true branch
130.   
131.       if (ctx != NULL) {
132.           if (!HMAC_CTX_reset(ctx)) {
                    ^
133.               HMAC_CTX_free(ctx);
134.               return NULL;

crypto/hmac/hmac.c:133:13: Skipping HMAC_CTX_free(): empty list of specs
131.       if (ctx != NULL) {
132.           if (!HMAC_CTX_reset(ctx)) {
133.               HMAC_CTX_free(ctx);
                   ^
134.               return NULL;
135.           }

HMAC_CTX *HMAC_CTX_new(void)
{
    HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));
    if (ctx != NULL) {
        if (!HMAC_CTX_reset(ctx)) {
            HMAC_CTX_free(ctx);
            return NULL;
        }
    }
    return ctx;
}
['HMAC_CTX *HMAC_CTX_new(void)\n{\n    HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));\n    if (ctx != NULL) {\n        if (!HMAC_CTX_reset(ctx)) {\n            HMAC_CTX_free(ctx);\n            return NULL;\n        }\n    }\n    return ctx;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\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    if (allow_customize) {\n        allow_customize = 0;\n    }\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}', 'int HMAC_CTX_reset(HMAC_CTX *ctx)\n{\n    hmac_ctx_cleanup(ctx);\n    if (!hmac_ctx_alloc_mds(ctx)) {\n        hmac_ctx_cleanup(ctx);\n        return 0;\n    }\n    return 1;\n}', 'static void hmac_ctx_cleanup(HMAC_CTX *ctx)\n{\n    EVP_MD_CTX_reset(ctx->i_ctx);\n    EVP_MD_CTX_reset(ctx->o_ctx);\n    EVP_MD_CTX_reset(ctx->md_ctx);\n    ctx->md = NULL;\n    ctx->key_length = 0;\n    OPENSSL_cleanse(ctx->key, sizeof(ctx->key));\n}']