ssl/ssl_lib.c:221: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_zalloc()` at line 219, column 13 is not reachable after line 221, column 26.
Showing all 36 steps of the trace


ssl/ssl_lib.c:210:1: start of procedure dane_ctx_enable()
208.   };
209.   
210. > static int dane_ctx_enable(struct dane_ctx_st *dctx)
211.   {
212.       const EVP_MD **mdevp;

ssl/ssl_lib.c:214:5: 
212.       const EVP_MD **mdevp;
213.       uint8_t *mdord;
214. >     uint8_t mdmax = DANETLS_MATCHING_LAST;
215.       int n = ((int) mdmax) + 1;          /* int to handle PrivMatch(255) */
216.       size_t i;

ssl/ssl_lib.c:215:5: 
213.       uint8_t *mdord;
214.       uint8_t mdmax = DANETLS_MATCHING_LAST;
215. >     int n = ((int) mdmax) + 1;          /* int to handle PrivMatch(255) */
216.       size_t i;
217.   

ssl/ssl_lib.c:218:5: 
216.       size_t i;
217.   
218. >     mdevp = OPENSSL_zalloc(n * sizeof(*mdevp));
219.       mdord = OPENSSL_zalloc(n * sizeof(*mdord));
220.   

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
  155.   }
  156.   
  157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  158.   {
  159.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:159:5: 
  157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  158.   {
  159. >     void *ret = CRYPTO_malloc(num, file, line);
  160.   
  161.       if (ret != NULL)

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

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

crypto/mem.c:124:9: Taking false branch
    122.       void *ret = NULL;
    123.   
    124.       if (num <= 0)
                   ^
    125.           return NULL;
    126.   

crypto/mem.c:127:5: 
    125.           return NULL;
    126.   
    127. >     allow_customize = 0;
    128.   #ifdef CRYPTO_MDEBUG
    129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
    135.       }
    136.   #else
    137. >     (void)file;
    138.       (void)line;
    139.       ret = malloc(num);

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

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

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

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

crypto/mem.c:161:9: Taking false branch
  159.       void *ret = CRYPTO_malloc(num, file, line);
  160.   
  161.       if (ret != NULL)
                 ^
  162.           memset(ret, 0, num);
  163.       return ret;

crypto/mem.c:163:5: 
  161.       if (ret != NULL)
  162.           memset(ret, 0, num);
  163. >     return ret;
  164.   }
  165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
  162.           memset(ret, 0, num);
  163.       return ret;
  164. > }
  165.   
  166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

ssl/ssl_lib.c:219:5: 
217.   
218.       mdevp = OPENSSL_zalloc(n * sizeof(*mdevp));
219. >     mdord = OPENSSL_zalloc(n * sizeof(*mdord));
220.   
221.       if (mdord == NULL || mdevp == NULL) {

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
  155.   }
  156.   
  157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  158.   {
  159.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:159:5: 
  157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  158.   {
  159. >     void *ret = CRYPTO_malloc(num, file, line);
  160.   
  161.       if (ret != NULL)

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

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

crypto/mem.c:124:9: Taking false branch
    122.       void *ret = NULL;
    123.   
    124.       if (num <= 0)
                   ^
    125.           return NULL;
    126.   

crypto/mem.c:127:5: 
    125.           return NULL;
    126.   
    127. >     allow_customize = 0;
    128.   #ifdef CRYPTO_MDEBUG
    129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
    135.       }
    136.   #else
    137. >     (void)file;
    138.       (void)line;
    139.       ret = malloc(num);

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

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

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

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

crypto/mem.c:161:9: Taking true branch
  159.       void *ret = CRYPTO_malloc(num, file, line);
  160.   
  161.       if (ret != NULL)
                 ^
  162.           memset(ret, 0, num);
  163.       return ret;

crypto/mem.c:162:9: 
  160.   
  161.       if (ret != NULL)
  162. >         memset(ret, 0, num);
  163.       return ret;
  164.   }

crypto/mem.c:163:5: 
  161.       if (ret != NULL)
  162.           memset(ret, 0, num);
  163. >     return ret;
  164.   }
  165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
  162.           memset(ret, 0, num);
  163.       return ret;
  164. > }
  165.   
  166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

ssl/ssl_lib.c:221:9: Taking false branch
219.       mdord = OPENSSL_zalloc(n * sizeof(*mdord));
220.   
221.       if (mdord == NULL || mdevp == NULL) {
               ^
222.           OPENSSL_free(mdevp);
223.           SSLerr(SSL_F_DANE_CTX_ENABLE, ERR_R_MALLOC_FAILURE);

ssl/ssl_lib.c:221:26: Taking true branch
219.       mdord = OPENSSL_zalloc(n * sizeof(*mdord));
220.   
221.       if (mdord == NULL || mdevp == NULL) {
                                ^
222.           OPENSSL_free(mdevp);
223.           SSLerr(SSL_F_DANE_CTX_ENABLE, ERR_R_MALLOC_FAILURE);

static int dane_ctx_enable(struct dane_ctx_st *dctx)
{
    const EVP_MD **mdevp;
    uint8_t *mdord;
    uint8_t mdmax = DANETLS_MATCHING_LAST;
    int n = ((int) mdmax) + 1;
    size_t i;
    mdevp = OPENSSL_zalloc(n * sizeof(*mdevp));
    mdord = OPENSSL_zalloc(n * sizeof(*mdord));
    if (mdord == NULL || mdevp == NULL) {
        OPENSSL_free(mdevp);
        SSLerr(SSL_F_DANE_CTX_ENABLE, ERR_R_MALLOC_FAILURE);
        return 0;
    }
    for (i = 0; i < OSSL_NELEM(dane_mds); ++i) {
        const EVP_MD *md;
        if (dane_mds[i].nid == NID_undef ||
            (md = EVP_get_digestbynid(dane_mds[i].nid)) == NULL)
            continue;
        mdevp[dane_mds[i].mtype] = md;
        mdord[dane_mds[i].mtype] = dane_mds[i].ord;
    }
    dctx->mdevp = mdevp;
    dctx->mdord = mdord;
    dctx->mdmax = mdmax;
    return 1;
}
['static int dane_ctx_enable(struct dane_ctx_st *dctx)\n{\n    const EVP_MD **mdevp;\n    uint8_t *mdord;\n    uint8_t mdmax = DANETLS_MATCHING_LAST;\n    int n = ((int) mdmax) + 1;\n    size_t i;\n    mdevp = OPENSSL_zalloc(n * sizeof(*mdevp));\n    mdord = OPENSSL_zalloc(n * sizeof(*mdord));\n    if (mdord == NULL || mdevp == NULL) {\n        OPENSSL_free(mdevp);\n        SSLerr(SSL_F_DANE_CTX_ENABLE, ERR_R_MALLOC_FAILURE);\n        return 0;\n    }\n    for (i = 0; i < OSSL_NELEM(dane_mds); ++i) {\n        const EVP_MD *md;\n        if (dane_mds[i].nid == NID_undef ||\n            (md = EVP_get_digestbynid(dane_mds[i].nid)) == NULL)\n            continue;\n        mdevp[dane_mds[i].mtype] = md;\n        mdord[dane_mds[i].mtype] = dane_mds[i].ord;\n    }\n    dctx->mdevp = mdevp;\n    dctx->mdord = mdord;\n    dctx->mdmax = mdmax;\n    return 1;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\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 (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifdef 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;\n    (void)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}']