crypto/asn1/a_digest.c:89: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `CRYPTO_malloc()` at line 81, column 16 is not reachable after line 89, column 9.
Showing all 18 steps of the trace


crypto/asn1/a_digest.c:74:1: start of procedure ASN1_digest()
72.   #ifndef NO_ASN1_OLD
73.   
74. > int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
75.                   unsigned char *md, unsigned int *len)
76.   {

crypto/asn1/a_digest.c:80:5: Skipping __function_pointer__(): unresolved function pointer
78.       unsigned char *str, *p;
79.   
80.       i = i2d(data, NULL);
          ^
81.       if ((str = OPENSSL_malloc(i)) == NULL) {
82.           ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);

crypto/asn1/a_digest.c:81:9: 
79.   
80.       i = i2d(data, NULL);
81. >     if ((str = OPENSSL_malloc(i)) == NULL) {
82.           ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);
83.           return (0);

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
  117.   }
  118.   
  119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  120.   {
  121.       void *ret = NULL;

crypto/mem.c:121:5: 
  119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  120.   {
  121. >     void *ret = NULL;
  122.   
  123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
  121.       void *ret = NULL;
  122.   
  123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  124.           return malloc_impl(num, file, line);
  125.   

crypto/mem.c:126:9: Taking false branch
  124.           return malloc_impl(num, file, line);
  125.   
  126.       if (num <= 0)
                 ^
  127.           return NULL;
  128.   

crypto/mem.c:129:5: 
  127.           return NULL;
  128.   
  129. >     allow_customize = 0;
  130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
  137.       }
  138.   #else
  139. >     osslargused(file); osslargused(line);
  140.       ret = malloc(num);
  141.   #endif

crypto/mem.c:139:24: 
  137.       }
  138.   #else
  139. >     osslargused(file); osslargused(line);
  140.       ret = malloc(num);
  141.   #endif

crypto/mem.c:140:5: 
  138.   #else
  139.       osslargused(file); osslargused(line);
  140. >     ret = malloc(num);
  141.   #endif
  142.   

crypto/mem.c:155:5: 
  153.   #endif
  154.   
  155. >     return ret;
  156.   }
  157.   

crypto/mem.c:156:1: return from a call to CRYPTO_malloc
  154.   
  155.       return ret;
  156. > }
  157.   
  158.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/asn1/a_digest.c:81:9: Taking false branch
79.   
80.       i = i2d(data, NULL);
81.       if ((str = OPENSSL_malloc(i)) == NULL) {
              ^
82.           ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);
83.           return (0);

crypto/asn1/a_digest.c:85:5: 
83.           return (0);
84.       }
85. >     p = str;
86.       i2d(data, &p);
87.   

crypto/asn1/a_digest.c:86:5: Skipping __function_pointer__(): unresolved function pointer
84.       }
85.       p = str;
86.       i2d(data, &p);
          ^
87.   
88.       if (!EVP_Digest(str, i, md, len, type, NULL))

crypto/asn1/a_digest.c:88:10: Taking true branch
86.       i2d(data, &p);
87.   
88.       if (!EVP_Digest(str, i, md, len, type, NULL))
               ^
89.           return 0;
90.       OPENSSL_free(str);

crypto/asn1/a_digest.c:89:9: 
87.   
88.       if (!EVP_Digest(str, i, md, len, type, NULL))
89. >         return 0;
90.       OPENSSL_free(str);
91.       return (1);

int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
                unsigned char *md, unsigned int *len)
{
    int i;
    unsigned char *str, *p;
    i = i2d(data, NULL);
    if ((str = OPENSSL_malloc(i)) == NULL) {
        ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);
        return (0);
    }
    p = str;
    i2d(data, &p);
    if (!EVP_Digest(str, i, md, len, type, NULL))
        return 0;
    OPENSSL_free(str);
    return (1);
}
['int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,\n                unsigned char *md, unsigned int *len)\n{\n    int i;\n    unsigned char *str, *p;\n    i = i2d(data, NULL);\n    if ((str = OPENSSL_malloc(i)) == NULL) {\n        ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);\n        return (0);\n    }\n    p = str;\n    i2d(data, &p);\n    if (!EVP_Digest(str, i, md, len, type, NULL))\n        return 0;\n    OPENSSL_free(str);\n    return (1);\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    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#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']