ssl/statem/statem_lib.c:477: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 328, column 24 is not reachable after line 477, column 5.
Showing all 70 steps of the trace


ssl/statem/statem_lib.c:312:1: start of procedure tls_process_cert_verify()
310.   }
311.   
312. > MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
313.   {
314.       EVP_PKEY *pkey = NULL;

ssl/statem/statem_lib.c:314:5: 
312.   MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
313.   {
314. >     EVP_PKEY *pkey = NULL;
315.       const unsigned char *data;
316.   #ifndef OPENSSL_NO_GOST

ssl/statem/statem_lib.c:317:5: 
315.       const unsigned char *data;
316.   #ifndef OPENSSL_NO_GOST
317. >     unsigned char *gost_data = NULL;
318.   #endif
319.       int al = SSL_AD_INTERNAL_ERROR;

ssl/statem/statem_lib.c:319:5: 
317.       unsigned char *gost_data = NULL;
318.   #endif
319. >     int al = SSL_AD_INTERNAL_ERROR;
320.       MSG_PROCESS_RETURN ret = MSG_PROCESS_ERROR;
321.       int j;

ssl/statem/statem_lib.c:320:5: 
318.   #endif
319.       int al = SSL_AD_INTERNAL_ERROR;
320. >     MSG_PROCESS_RETURN ret = MSG_PROCESS_ERROR;
321.       int j;
322.       unsigned int len;

ssl/statem/statem_lib.c:324:5: 
322.       unsigned int len;
323.       X509 *peer;
324. >     const EVP_MD *md = NULL;
325.       size_t hdatalen = 0;
326.       void *hdata;

ssl/statem/statem_lib.c:325:5: 
323.       X509 *peer;
324.       const EVP_MD *md = NULL;
325. >     size_t hdatalen = 0;
326.       void *hdata;
327.       unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE];

ssl/statem/statem_lib.c:328:5: 
326.       void *hdata;
327.       unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE];
328. >     EVP_MD_CTX *mctx = EVP_MD_CTX_new();
329.       EVP_PKEY_CTX *pctx = NULL;
330.   

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:198:1: start of procedure CRYPTO_zalloc()
    196.   }
    197.   
    198. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    199.   {
    200.       void *ret = CRYPTO_malloc(num, file, line);

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

crypto/mem.c:170:1: start of procedure CRYPTO_malloc()
      168.   #endif
      169.   
      170. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      171.   {
      172.       void *ret = NULL;

crypto/mem.c:172:5: 
      170.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      171.   {
      172. >     void *ret = NULL;
      173.   
      174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:174:9: Taking false branch
      172.       void *ret = NULL;
      173.   
      174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      175.           return malloc_impl(num, file, line);
      176.   

crypto/mem.c:177:9: Taking false branch
      175.           return malloc_impl(num, file, line);
      176.   
      177.       if (num == 0)
                     ^
      178.           return NULL;
      179.   

crypto/mem.c:181:5: 
      179.   
      180.       FAILTEST();
      181. >     allow_customize = 0;
      182.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      183.       if (call_malloc_debug) {

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

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

crypto/mem.c:192:5: 
      190.   #else
      191.       (void)(file); (void)(line);
      192. >     ret = malloc(num);
      193.   #endif
      194.   

crypto/mem.c:195:5: 
      193.   #endif
      194.   
      195. >     return ret;
      196.   }
      197.   

crypto/mem.c:196:1: return from a call to CRYPTO_malloc
      194.   
      195.       return ret;
      196. > }
      197.   
      198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

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

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

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

crypto/mem.c:206:1: return from a call to CRYPTO_zalloc
    204.           memset(ret, 0, num);
    205.       return ret;
    206. > }
    207.   
    208.   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)

ssl/statem/statem_lib.c:329:5: 
327.       unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE];
328.       EVP_MD_CTX *mctx = EVP_MD_CTX_new();
329. >     EVP_PKEY_CTX *pctx = NULL;
330.   
331.       if (mctx == NULL) {

ssl/statem/statem_lib.c:331:9: Taking false branch
329.       EVP_PKEY_CTX *pctx = NULL;
330.   
331.       if (mctx == NULL) {
               ^
332.           SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_MALLOC_FAILURE);
333.           goto f_err;

ssl/statem/statem_lib.c:336:5: 
334.       }
335.   
336. >     peer = s->session->peer;
337.       pkey = X509_get0_pubkey(peer);
338.       if (pkey == NULL)

ssl/statem/statem_lib.c:337:5: 
335.   
336.       peer = s->session->peer;
337. >     pkey = X509_get0_pubkey(peer);
338.       if (pkey == NULL)
339.           goto f_err;

crypto/x509/x509_cmp.c:264:1: start of procedure X509_get0_pubkey()
  262.   }
  263.   
  264. > EVP_PKEY *X509_get0_pubkey(const X509 *x)
  265.   {
  266.       if (x == NULL)

crypto/x509/x509_cmp.c:266:9: Taking false branch
  264.   EVP_PKEY *X509_get0_pubkey(const X509 *x)
  265.   {
  266.       if (x == NULL)
                 ^
  267.           return NULL;
  268.       return X509_PUBKEY_get0(x->cert_info.key);

crypto/x509/x509_cmp.c:268:5: 
  266.       if (x == NULL)
  267.           return NULL;
  268. >     return X509_PUBKEY_get0(x->cert_info.key);
  269.   }
  270.   

crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0()
    138.   }
    139.   
    140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
    141.   {
    142.       EVP_PKEY *ret = NULL;

crypto/x509/x_pubkey.c:142:5: 
    140.   EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
    141.   {
    142. >     EVP_PKEY *ret = NULL;
    143.   
    144.       if (key == NULL || key->public_key == NULL)

crypto/x509/x_pubkey.c:144:9: Taking false branch
    142.       EVP_PKEY *ret = NULL;
    143.   
    144.       if (key == NULL || key->public_key == NULL)
                   ^
    145.           return NULL;
    146.   

crypto/x509/x_pubkey.c:144:24: Taking false branch
    142.       EVP_PKEY *ret = NULL;
    143.   
    144.       if (key == NULL || key->public_key == NULL)
                                  ^
    145.           return NULL;
    146.   

crypto/x509/x_pubkey.c:147:9: Taking false branch
    145.           return NULL;
    146.   
    147.       if (key->pkey != NULL)
                   ^
    148.           return key->pkey;
    149.   

crypto/x509/x_pubkey.c:158:5: 
    156.        * in the queue.
    157.        */
    158. >     x509_pubkey_decode(&ret, key);
    159.       /* If decode doesn't fail something bad happened */
    160.       if (ret != NULL) {

crypto/x509/x_pubkey.c:103:1: start of procedure x509_pubkey_decode()
      101.   
      102.   
      103. > static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key)
      104.       {
      105.       EVP_PKEY *pkey = EVP_PKEY_new();

crypto/x509/x_pubkey.c:105:5: Skipping EVP_PKEY_new(): empty list of specs
      103.   static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key)
      104.       {
      105.       EVP_PKEY *pkey = EVP_PKEY_new();
                 ^
      106.   
      107.       if (pkey == NULL) {

crypto/x509/x_pubkey.c:107:9: Taking true branch
      105.       EVP_PKEY *pkey = EVP_PKEY_new();
      106.   
      107.       if (pkey == NULL) {
                     ^
      108.           X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
      109.           return -1;

crypto/x509/x_pubkey.c:108:9: Skipping ERR_put_error(): empty list of specs
      106.   
      107.       if (pkey == NULL) {
      108.           X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
                     ^
      109.           return -1;
      110.       }

crypto/x509/x_pubkey.c:109:9: 
      107.       if (pkey == NULL) {
      108.           X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
      109. >         return -1;
      110.       }
      111.   

crypto/x509/x_pubkey.c:138:1: return from a call to x509_pubkey_decode
      136.       EVP_PKEY_free(pkey);
      137.       return 0;
      138. > }
      139.   
      140.   EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)

crypto/x509/x_pubkey.c:160:9: Taking false branch
    158.       x509_pubkey_decode(&ret, key);
    159.       /* If decode doesn't fail something bad happened */
    160.       if (ret != NULL) {
                   ^
    161.           X509err(X509_F_X509_PUBKEY_GET0, ERR_R_INTERNAL_ERROR);
    162.           EVP_PKEY_free(ret);

crypto/x509/x_pubkey.c:165:5: 
    163.       }
    164.   
    165. >     return NULL;
    166.   }
    167.   

crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0
    164.   
    165.       return NULL;
    166. > }
    167.   
    168.   EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)

crypto/x509/x509_cmp.c:269:1: return from a call to X509_get0_pubkey
  267.           return NULL;
  268.       return X509_PUBKEY_get0(x->cert_info.key);
  269. > }
  270.   
  271.   EVP_PKEY *X509_get_pubkey(X509 *x)

ssl/statem/statem_lib.c:338:9: Taking true branch
336.       peer = s->session->peer;
337.       pkey = X509_get0_pubkey(peer);
338.       if (pkey == NULL)
               ^
339.           goto f_err;
340.   

ssl/statem/statem_lib.c:471:2: 
469.       ret = MSG_PROCESS_CONTINUE_READING;
470.       if (0) {
471. >  f_err:
472.           ssl3_send_alert(s, SSL3_AL_FATAL, al);
473.           ossl_statem_set_error(s);

ssl/statem/statem_lib.c:472:9: Skipping ssl3_send_alert(): empty list of specs
470.       if (0) {
471.    f_err:
472.           ssl3_send_alert(s, SSL3_AL_FATAL, al);
               ^
473.           ossl_statem_set_error(s);
474.       }

ssl/statem/statem_lib.c:473:9: 
471.    f_err:
472.           ssl3_send_alert(s, SSL3_AL_FATAL, al);
473. >         ossl_statem_set_error(s);
474.       }
475.       BIO_free(s->s3->handshake_buffer);

ssl/statem/statem.c:117:1: start of procedure ossl_statem_set_error()
  115.    * the current connection.
  116.    */
  117. > void ossl_statem_set_error(SSL *s)
  118.   {
  119.       s->statem.state = MSG_FLOW_ERROR;

ssl/statem/statem.c:119:5: 
  117.   void ossl_statem_set_error(SSL *s)
  118.   {
  119. >     s->statem.state = MSG_FLOW_ERROR;
  120.   }
  121.   

ssl/statem/statem.c:120:1: return from a call to ossl_statem_set_error
  118.   {
  119.       s->statem.state = MSG_FLOW_ERROR;
  120. > }
  121.   
  122.   /*

ssl/statem/statem_lib.c:475:5: Skipping BIO_free(): empty list of specs
473.           ossl_statem_set_error(s);
474.       }
475.       BIO_free(s->s3->handshake_buffer);
           ^
476.       s->s3->handshake_buffer = NULL;
477.       EVP_MD_CTX_free(mctx);

ssl/statem/statem_lib.c:476:5: 
474.       }
475.       BIO_free(s->s3->handshake_buffer);
476. >     s->s3->handshake_buffer = NULL;
477.       EVP_MD_CTX_free(mctx);
478.   #ifndef OPENSSL_NO_GOST

ssl/statem/statem_lib.c:477:5: 
475.       BIO_free(s->s3->handshake_buffer);
476.       s->s3->handshake_buffer = NULL;
477. >     EVP_MD_CTX_free(mctx);
478.   #ifndef OPENSSL_NO_GOST
479.       OPENSSL_free(gost_data);

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:265:1: start of procedure CRYPTO_free()
    263.   }
    264.   
    265. > void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:267:9: Taking true branch
    265.   void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    268.           free_impl(str, file, line);
    269.           return;

crypto/mem.c:267:30: Taking true branch
    265.   void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    268.           free_impl(str, file, line);
    269.           return;

crypto/mem.c:268:9: Skipping __function_pointer__(): unresolved function pointer
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    268.           free_impl(str, file, line);
                   ^
    269.           return;
    270.       }

crypto/mem.c:269:9: 
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    268.           free_impl(str, file, line);
    269. >         return;
    270.       }
    271.   

crypto/mem.c:283:1: return from a call to CRYPTO_free
    281.       free(str);
    282.   #endif
    283. > }
    284.   
    285.   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)
