crypto/x509/x509_cmp.c:224: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 208, column 26 is not reachable after line 224, column 5.
Showing all 53 steps of the trace


crypto/x509/x509_cmp.c:206:1: start of procedure X509_NAME_hash_old()
204.    */
205.   
206. > unsigned long X509_NAME_hash_old(X509_NAME *x)
207.   {
208.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();

crypto/x509/x509_cmp.c:208:5: 
206.   unsigned long X509_NAME_hash_old(X509_NAME *x)
207.   {
208. >     EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
209.       unsigned long ret = 0;
210.       unsigned char md[16];

crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new()
  42.   }
  43.   
  44. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:46:5: 
  44.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47.   }
  48.   

crypto/mem.c:197:1: start of procedure CRYPTO_zalloc()
    195.   }
    196.   
    197. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    198.   {
    199.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:199:5: 
    197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    198.   {
    199. >     void *ret = CRYPTO_malloc(num, file, line);
    200.   
    201.       FAILTEST();

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. >     (void)(file); (void)(line);
      191.       ret = malloc(num);
      192.   #endif

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

crypto/mem.c:191:5: 
      189.   #else
      190.       (void)(file); (void)(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/mem.c:202:9: Taking true branch
    200.   
    201.       FAILTEST();
    202.       if (ret != NULL)
                   ^
    203.           memset(ret, 0, num);
    204.       return ret;

crypto/mem.c:203:9: 
    201.       FAILTEST();
    202.       if (ret != NULL)
    203. >         memset(ret, 0, num);
    204.       return ret;
    205.   }

crypto/mem.c:204:5: 
    202.       if (ret != NULL)
    203.           memset(ret, 0, num);
    204. >     return ret;
    205.   }
    206.   

crypto/mem.c:205:1: return from a call to CRYPTO_zalloc
    203.           memset(ret, 0, num);
    204.       return ret;
    205. > }
    206.   
    207.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47. > }
  48.   
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/x509/x509_cmp.c:209:5: 
207.   {
208.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
209. >     unsigned long ret = 0;
210.       unsigned char md[16];
211.   

crypto/x509/x509_cmp.c:212:9: Taking false branch
210.       unsigned char md[16];
211.   
212.       if (md_ctx == NULL)
               ^
213.           return ret;
214.   

crypto/x509/x509_cmp.c:216:5: 
214.   
215.       /* Make sure X509_NAME structure contains valid cached encoding */
216. >     i2d_X509_NAME(x, NULL);
217.       EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
218.       if (EVP_DigestInit_ex(md_ctx, EVP_md5(), NULL)

crypto/x509/x_name.c:86:1: start of procedure i2d_X509_NAME()
  84.   IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff)
  85.   
  86. > IMPLEMENT_ASN1_FUNCTIONS(X509_NAME)
  87.   
  88.   IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME)

crypto/asn1/tasn_enc.c:42:1: start of procedure ASN1_item_i2d()
    40.   }
    41.   
    42. > int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
    43.   {
    44.       return asn1_item_flags_i2d(val, out, it, 0);

crypto/asn1/tasn_enc.c:44:5: 
    42.   int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
    43.   {
    44. >     return asn1_item_flags_i2d(val, out, it, 0);
    45.   }
    46.   

crypto/asn1/tasn_enc.c:54:1: start of procedure asn1_item_flags_i2d()
      52.    */
      53.   
      54. > static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,
      55.                                  const ASN1_ITEM *it, int flags)
      56.   {

crypto/asn1/tasn_enc.c:57:9: Taking false branch
      55.                                  const ASN1_ITEM *it, int flags)
      56.   {
      57.       if (out && !*out) {
                    ^
      58.           unsigned char *p, *buf;
      59.           int len;

crypto/asn1/tasn_enc.c:72:5: Skipping ASN1_item_ex_i2d(): empty list of specs
      70.       }
      71.   
      72.       return ASN1_item_ex_i2d(&val, out, it, -1, flags);
                ^
      73.   }
      74.   

crypto/asn1/tasn_enc.c:73:1: return from a call to asn1_item_flags_i2d
      71.   
      72.       return ASN1_item_ex_i2d(&val, out, it, -1, flags);
      73. > }
      74.   
      75.   /*

crypto/asn1/tasn_enc.c:45:1: return from a call to ASN1_item_i2d
    43.   {
    44.       return asn1_item_flags_i2d(val, out, it, 0);
    45. > }
    46.   
    47.   /*

crypto/x509/x_name.c:86:1: return from a call to i2d_X509_NAME
  84.   IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff)
  85.   
  86. > IMPLEMENT_ASN1_FUNCTIONS(X509_NAME)
  87.   
  88.   IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME)

crypto/x509/x509_cmp.c:217:5: 
215.       /* Make sure X509_NAME structure contains valid cached encoding */
216.       i2d_X509_NAME(x, NULL);
217. >     EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
218.       if (EVP_DigestInit_ex(md_ctx, EVP_md5(), NULL)
219.           && EVP_DigestUpdate(md_ctx, x->bytes->data, x->bytes->length)

crypto/evp/evp_lib.c:469:1: start of procedure EVP_MD_CTX_set_flags()
  467.   }
  468.   
  469. > void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)
  470.   {
  471.       ctx->flags |= flags;

crypto/evp/evp_lib.c:471:5: 
  469.   void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)
  470.   {
  471. >     ctx->flags |= flags;
  472.   }
  473.   

crypto/evp/evp_lib.c:472:1: return from a call to EVP_MD_CTX_set_flags
  470.   {
  471.       ctx->flags |= flags;
  472. > }
  473.   
  474.   void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags)

crypto/x509/x509_cmp.c:218:9: 
216.       i2d_X509_NAME(x, NULL);
217.       EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
218. >     if (EVP_DigestInit_ex(md_ctx, EVP_md5(), NULL)
219.           && EVP_DigestUpdate(md_ctx, x->bytes->data, x->bytes->length)
220.           && EVP_DigestFinal_ex(md_ctx, md, NULL))

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/x509/x509_cmp.c:218:9: Taking false branch
216.       i2d_X509_NAME(x, NULL);
217.       EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
218.       if (EVP_DigestInit_ex(md_ctx, EVP_md5(), NULL)
               ^
219.           && EVP_DigestUpdate(md_ctx, x->bytes->data, x->bytes->length)
220.           && EVP_DigestFinal_ex(md_ctx, md, NULL))

crypto/x509/x509_cmp.c:224:5: 
222.                  ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L)
223.               ) & 0xffffffffL;
224. >     EVP_MD_CTX_free(md_ctx);
225.   
226.       return (ret);

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free()
  47.   }
  48.   
  49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
            ^
  52.       OPENSSL_free(ctx);
  53.   }

crypto/evp/digest.c:52:5: 
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
  52. >     OPENSSL_free(ctx);
  53.   }
  54.   

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/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free
  51.       EVP_MD_CTX_reset(ctx);
  52.       OPENSSL_free(ctx);
  53. > }
  54.   
  55.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

unsigned long X509_NAME_hash_old(X509_NAME *x)
{
    EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
    unsigned long ret = 0;
    unsigned char md[16];
    if (md_ctx == NULL)
        return ret;
    i2d_X509_NAME(x, NULL);
    EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
    if (EVP_DigestInit_ex(md_ctx, EVP_md5(), NULL)
        && EVP_DigestUpdate(md_ctx, x->bytes->data, x->bytes->length)
        && EVP_DigestFinal_ex(md_ctx, md, NULL))
        ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) |
               ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L)
            ) & 0xffffffffL;
    EVP_MD_CTX_free(md_ctx);
    return (ret);
}
['unsigned long X509_NAME_hash_old(X509_NAME *x)\n{\n    EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();\n    unsigned long ret = 0;\n    unsigned char md[16];\n    if (md_ctx == NULL)\n        return ret;\n    i2d_X509_NAME(x, NULL);\n    EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);\n    if (EVP_DigestInit_ex(md_ctx, EVP_md5(), NULL)\n        && EVP_DigestUpdate(md_ctx, x->bytes->data, x->bytes->length)\n        && EVP_DigestFinal_ex(md_ctx, md, NULL))\n        ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) |\n               ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L)\n            ) & 0xffffffffL;\n    EVP_MD_CTX_free(md_ctx);\n    return (ret);\n}', 'EVP_MD_CTX *EVP_MD_CTX_new(void)\n{\n    return OPENSSL_zalloc(sizeof(EVP_MD_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    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}', 'IMPLEMENT_ASN1_FUNCTIONS(X509_NAME)', 'int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)\n{\n    return asn1_item_flags_i2d(val, out, it, 0);\n}', 'static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,\n                               const ASN1_ITEM *it, int flags)\n{\n    if (out && !*out) {\n        unsigned char *p, *buf;\n        int len;\n        len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags);\n        if (len <= 0)\n            return len;\n        buf = OPENSSL_malloc(len);\n        if (buf == NULL)\n            return -1;\n        p = buf;\n        ASN1_item_ex_i2d(&val, &p, it, -1, flags);\n        *out = buf;\n        return len;\n    }\n    return ASN1_item_ex_i2d(&val, out, it, -1, flags);\n}', 'void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)\n{\n    ctx->flags |= flags;\n}', 'const EVP_MD *EVP_md5(void)\n{\n    return (&md5_md);\n}', 'void EVP_MD_CTX_free(EVP_MD_CTX *ctx)\n{\n    EVP_MD_CTX_reset(ctx);\n    OPENSSL_free(ctx);\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}']