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


ssl/ssl_lib.c:206:1: start of procedure dane_ctx_enable()
204.   };
205.   
206. > static int dane_ctx_enable(struct dane_ctx_st *dctx)
207.   {
208.       const EVP_MD **mdevp;

ssl/ssl_lib.c:210:5: 
208.       const EVP_MD **mdevp;
209.       uint8_t *mdord;
210. >     uint8_t mdmax = DANETLS_MATCHING_LAST;
211.       int n = ((int) mdmax) + 1;          /* int to handle PrivMatch(255) */
212.       size_t i;

ssl/ssl_lib.c:211:5: 
209.       uint8_t *mdord;
210.       uint8_t mdmax = DANETLS_MATCHING_LAST;
211. >     int n = ((int) mdmax) + 1;          /* int to handle PrivMatch(255) */
212.       size_t i;
213.   

ssl/ssl_lib.c:214:5: 
212.       size_t i;
213.   
214. >     mdevp = OPENSSL_zalloc(n * sizeof(*mdevp));
215.       mdord = OPENSSL_zalloc(n * sizeof(*mdord));
216.   

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
  144.   }
  145.   
  146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
  146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148. >     void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       if (ret != NULL)

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 true 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:123:32: Taking true 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:124:9: Skipping __function_pointer__(): unresolved function pointer
    122.   
    123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
    124.           return malloc_impl(num, file, line);
                   ^
    125.   
    126.       if (num <= 0)

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
    142.   
    143.       return ret;
    144. > }
    145.   
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking false branch
  148.       void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       if (ret != NULL)
                 ^
  151.           memset(ret, 0, num);
  152.       return ret;

crypto/mem.c:152:5: 
  150.       if (ret != NULL)
  151.           memset(ret, 0, num);
  152. >     return ret;
  153.   }
  154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
  151.           memset(ret, 0, num);
  152.       return ret;
  153. > }
  154.   
  155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

ssl/ssl_lib.c:215:5: 
213.   
214.       mdevp = OPENSSL_zalloc(n * sizeof(*mdevp));
215. >     mdord = OPENSSL_zalloc(n * sizeof(*mdord));
216.   
217.       if (mdord == NULL || mdevp == NULL) {

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
  144.   }
  145.   
  146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
  146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148. >     void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       if (ret != NULL)

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:143:5: 
    141.   #endif
    142.   
    143. >     return ret;
    144.   }
    145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
    142.   
    143.       return ret;
    144. > }
    145.   
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking true branch
  148.       void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       if (ret != NULL)
                 ^
  151.           memset(ret, 0, num);
  152.       return ret;

crypto/mem.c:151:9: 
  149.   
  150.       if (ret != NULL)
  151. >         memset(ret, 0, num);
  152.       return ret;
  153.   }

crypto/mem.c:152:5: 
  150.       if (ret != NULL)
  151.           memset(ret, 0, num);
  152. >     return ret;
  153.   }
  154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
  151.           memset(ret, 0, num);
  152.       return ret;
  153. > }
  154.   
  155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

ssl/ssl_lib.c:217:9: Taking false branch
215.       mdord = OPENSSL_zalloc(n * sizeof(*mdord));
216.   
217.       if (mdord == NULL || mdevp == NULL) {
               ^
218.           OPENSSL_free(mdevp);
219.           SSLerr(SSL_F_DANE_CTX_ENABLE, ERR_R_MALLOC_FAILURE);

ssl/ssl_lib.c:217:26: Taking true branch
215.       mdord = OPENSSL_zalloc(n * sizeof(*mdord));
216.   
217.       if (mdord == NULL || mdevp == NULL) {
                                ^
218.           OPENSSL_free(mdevp);
219.           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 (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}']