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


crypto/asn1/a_digest.c:26:1: start of procedure ASN1_digest()
24.   #ifndef NO_ASN1_OLD
25.   
26. > int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
27.                   unsigned char *md, unsigned int *len)
28.   {

crypto/asn1/a_digest.c:32:5: Skipping __function_pointer__(): unresolved function pointer
30.       unsigned char *str, *p;
31.   
32.       i = i2d(data, NULL);
          ^
33.       if ((str = OPENSSL_malloc(i)) == NULL) {
34.           ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);

crypto/asn1/a_digest.c:33:9: 
31.   
32.       i = i2d(data, NULL);
33. >     if ((str = OPENSSL_malloc(i)) == NULL) {
34.           ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);
35.           return (0);

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
  69.   }
  70.   
  71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  72.   {
  73.       void *ret = NULL;

crypto/mem.c:73:5: 
  71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  72.   {
  73. >     void *ret = NULL;
  74.   
  75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
  73.       void *ret = NULL;
  74.   
  75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                ^
  76.           return malloc_impl(num, file, line);
  77.   

crypto/mem.c:78:9: Taking false branch
  76.           return malloc_impl(num, file, line);
  77.   
  78.       if (num <= 0)
                ^
  79.           return NULL;
  80.   

crypto/mem.c:81:5: 
  79.           return NULL;
  80.   
  81. >     allow_customize = 0;
  82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
  89.       }
  90.   #else
  91. >     osslargused(file); osslargused(line);
  92.       ret = malloc(num);
  93.   #endif

crypto/mem.c:91:24: 
  89.       }
  90.   #else
  91. >     osslargused(file); osslargused(line);
  92.       ret = malloc(num);
  93.   #endif

crypto/mem.c:92:5: 
  90.   #else
  91.       osslargused(file); osslargused(line);
  92. >     ret = malloc(num);
  93.   #endif
  94.   

crypto/mem.c:95:5: 
  93.   #endif
  94.   
  95. >     return ret;
  96.   }
  97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
  94.   
  95.       return ret;
  96. > }
  97.   
  98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/asn1/a_digest.c:33:9: Taking false branch
31.   
32.       i = i2d(data, NULL);
33.       if ((str = OPENSSL_malloc(i)) == NULL) {
              ^
34.           ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);
35.           return (0);

crypto/asn1/a_digest.c:37:5: 
35.           return (0);
36.       }
37. >     p = str;
38.       i2d(data, &p);
39.   

crypto/asn1/a_digest.c:38:5: Skipping __function_pointer__(): unresolved function pointer
36.       }
37.       p = str;
38.       i2d(data, &p);
          ^
39.   
40.       if (!EVP_Digest(str, i, md, len, type, NULL))

crypto/asn1/a_digest.c:40:10: Taking true branch
38.       i2d(data, &p);
39.   
40.       if (!EVP_Digest(str, i, md, len, type, NULL))
               ^
41.           return 0;
42.       OPENSSL_free(str);

crypto/asn1/a_digest.c:41:9: 
39.   
40.       if (!EVP_Digest(str, i, md, len, type, NULL))
41. >         return 0;
42.       OPENSSL_free(str);
43.       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    return ret;\n}']