ssl/statem/extensions_srvr.c:760: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 754, column 12 is not reachable after line 760, column 9.
Showing all 79 steps of the trace


ssl/statem/extensions_srvr.c:717:1: start of procedure tls_parse_ctos_cookie()
715.   }
716.   
717. > int tls_parse_ctos_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
718.                             size_t chainidx)
719.   {

ssl/statem/extensions_srvr.c:732:9: Taking false branch
730.   
731.       /* Ignore any cookie if we're not set up to verify it */
732.       if (s->ctx->verify_stateless_cookie_cb == NULL
               ^
733.               || (s->s3->flags & TLS1_FLAGS_STATELESS) == 0)
734.           return 1;

ssl/statem/extensions_srvr.c:733:16: Taking false branch
731.       /* Ignore any cookie if we're not set up to verify it */
732.       if (s->ctx->verify_stateless_cookie_cb == NULL
733.               || (s->s3->flags & TLS1_FLAGS_STATELESS) == 0)
                      ^
734.           return 1;
735.   

ssl/statem/extensions_srvr.c:736:10: Taking false branch
734.           return 1;
735.   
736.       if (!PACKET_as_length_prefixed_2(pkt, &cookie)) {
                ^
737.           SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_CTOS_COOKIE,
738.                    SSL_R_LENGTH_MISMATCH);

ssl/statem/extensions_srvr.c:742:5: 
740.       }
741.   
742. >     raw = cookie;
743.       data = PACKET_data(&raw);
744.       rawlen = PACKET_remaining(&raw);

ssl/statem/extensions_srvr.c:743:5: 
741.   
742.       raw = cookie;
743. >     data = PACKET_data(&raw);
744.       rawlen = PACKET_remaining(&raw);
745.       if (rawlen < SHA256_DIGEST_LENGTH

ssl/packet_locl.h:62:1: start of procedure PACKET_data()
  60.    * For use in non-PACKETized APIs.
  61.    */
  62. > static ossl_inline const unsigned char *PACKET_data(const PACKET *pkt)
  63.   {
  64.       return pkt->curr;

ssl/packet_locl.h:64:5: 
  62.   static ossl_inline const unsigned char *PACKET_data(const PACKET *pkt)
  63.   {
  64. >     return pkt->curr;
  65.   }
  66.   

ssl/packet_locl.h:65:1: return from a call to PACKET_data
  63.   {
  64.       return pkt->curr;
  65. > }
  66.   
  67.   /*

ssl/statem/extensions_srvr.c:744:5: 
742.       raw = cookie;
743.       data = PACKET_data(&raw);
744. >     rawlen = PACKET_remaining(&raw);
745.       if (rawlen < SHA256_DIGEST_LENGTH
746.               || !PACKET_forward(&raw, rawlen - SHA256_DIGEST_LENGTH)) {

ssl/packet_locl.h:42:1: start of procedure PACKET_remaining()
  40.    * Returns the number of bytes remaining to be read in the PACKET
  41.    */
  42. > static ossl_inline size_t PACKET_remaining(const PACKET *pkt)
  43.   {
  44.       return pkt->remaining;

ssl/packet_locl.h:44:5: 
  42.   static ossl_inline size_t PACKET_remaining(const PACKET *pkt)
  43.   {
  44. >     return pkt->remaining;
  45.   }
  46.   

ssl/packet_locl.h:45:1: return from a call to PACKET_remaining
  43.   {
  44.       return pkt->remaining;
  45. > }
  46.   
  47.   /*

ssl/statem/extensions_srvr.c:745:9: Taking false branch
743.       data = PACKET_data(&raw);
744.       rawlen = PACKET_remaining(&raw);
745.       if (rawlen < SHA256_DIGEST_LENGTH
               ^
746.               || !PACKET_forward(&raw, rawlen - SHA256_DIGEST_LENGTH)) {
747.           SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_CTOS_COOKIE,

ssl/statem/extensions_srvr.c:746:17: 
744.       rawlen = PACKET_remaining(&raw);
745.       if (rawlen < SHA256_DIGEST_LENGTH
746. >             || !PACKET_forward(&raw, rawlen - SHA256_DIGEST_LENGTH)) {
747.           SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_CTOS_COOKIE,
748.                    SSL_R_LENGTH_MISMATCH);

ssl/packet_locl.h:467:8: start of procedure PACKET_forward()
  465.   
  466.   /* Move the current reading position forward |len| bytes */
  467.   __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
                ^
  468.   {
  469.       if (PACKET_remaining(pkt) < len)

ssl/packet_locl.h:469:9: 
  467.   __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
  468.   {
  469. >     if (PACKET_remaining(pkt) < len)
  470.           return 0;
  471.   

ssl/packet_locl.h:42:1: start of procedure PACKET_remaining()
    40.    * Returns the number of bytes remaining to be read in the PACKET
    41.    */
    42. > static ossl_inline size_t PACKET_remaining(const PACKET *pkt)
    43.   {
    44.       return pkt->remaining;

ssl/packet_locl.h:44:5: 
    42.   static ossl_inline size_t PACKET_remaining(const PACKET *pkt)
    43.   {
    44. >     return pkt->remaining;
    45.   }
    46.   

ssl/packet_locl.h:45:1: return from a call to PACKET_remaining
    43.   {
    44.       return pkt->remaining;
    45. > }
    46.   
    47.   /*

ssl/packet_locl.h:469:9: Taking false branch
  467.   __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
  468.   {
  469.       if (PACKET_remaining(pkt) < len)
                 ^
  470.           return 0;
  471.   

ssl/packet_locl.h:472:5: 
  470.           return 0;
  471.   
  472. >     packet_forward(pkt, len);
  473.   
  474.       return 1;

ssl/packet_locl.h:33:1: start of procedure packet_forward()
    31.   
    32.   /* Internal unchecked shorthand; don't use outside this file. */
    33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
    34.   {
    35.       pkt->curr += len;

ssl/packet_locl.h:35:5: 
    33.   static ossl_inline void packet_forward(PACKET *pkt, size_t len)
    34.   {
    35. >     pkt->curr += len;
    36.       pkt->remaining -= len;
    37.   }

ssl/packet_locl.h:36:5: 
    34.   {
    35.       pkt->curr += len;
    36. >     pkt->remaining -= len;
    37.   }
    38.   

ssl/packet_locl.h:37:1: return from a call to packet_forward
    35.       pkt->curr += len;
    36.       pkt->remaining -= len;
    37. > }
    38.   
    39.   /*

ssl/packet_locl.h:474:5: 
  472.       packet_forward(pkt, len);
  473.   
  474. >     return 1;
  475.   }
  476.   

ssl/packet_locl.h:475:1: return from a call to PACKET_forward
  473.   
  474.       return 1;
  475. > }
  476.   
  477.   /*

ssl/statem/extensions_srvr.c:746:17: Taking false branch
744.       rawlen = PACKET_remaining(&raw);
745.       if (rawlen < SHA256_DIGEST_LENGTH
746.               || !PACKET_forward(&raw, rawlen - SHA256_DIGEST_LENGTH)) {
                       ^
747.           SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_CTOS_COOKIE,
748.                    SSL_R_LENGTH_MISMATCH);

ssl/statem/extensions_srvr.c:751:5: 
749.           return 0;
750.       }
751. >     mdin = PACKET_data(&raw);
752.   
753.       /* Verify the HMAC of the cookie */

ssl/packet_locl.h:62:1: start of procedure PACKET_data()
  60.    * For use in non-PACKETized APIs.
  61.    */
  62. > static ossl_inline const unsigned char *PACKET_data(const PACKET *pkt)
  63.   {
  64.       return pkt->curr;

ssl/packet_locl.h:64:5: 
  62.   static ossl_inline const unsigned char *PACKET_data(const PACKET *pkt)
  63.   {
  64. >     return pkt->curr;
  65.   }
  66.   

ssl/packet_locl.h:65:1: return from a call to PACKET_data
  63.   {
  64.       return pkt->curr;
  65. > }
  66.   
  67.   /*

ssl/statem/extensions_srvr.c:754:5: 
752.   
753.       /* Verify the HMAC of the cookie */
754. >     hctx = EVP_MD_CTX_create();
755.       pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_HMAC, NULL,
756.                                           s->session_ctx->ext.cookie_hmac_key,

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:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
      190.   #endif
      191.   
      192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194.       void *ret = NULL;

crypto/mem.c:194:5: 
      192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194. >     void *ret = NULL;
      195.   
      196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
      195.   
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      198.           return malloc_impl(num, file, line);
      199.   

crypto/mem.c:200:9: Taking false branch
      198.           return malloc_impl(num, file, line);
      199.   
      200.       if (num == 0)
                     ^
      201.           return NULL;
      202.   

crypto/mem.c:204:9: Taking true branch
      202.   
      203.       FAILTEST();
      204.       if (allow_customize) {
                     ^
      205.           /*
      206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
      208.            * allocation.
      209.            */
      210. >         allow_customize = 0;
      211.       }
      212.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:221:5: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:221:19: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:222:5: 
      220.   #else
      221.       (void)(file); (void)(line);
      222. >     ret = malloc(num);
      223.   #endif
      224.   

crypto/mem.c:225:5: 
      223.   #endif
      224.   
      225. >     return ret;
      226.   }
      227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
      224.   
      225.       return ret;
      226. > }
      227.   
      228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking true branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:234:9: 
    232.       FAILTEST();
    233.       if (ret != NULL)
    234. >         memset(ret, 0, num);
    235.       return ret;
    236.   }

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   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/extensions_srvr.c:755:5: 
753.       /* Verify the HMAC of the cookie */
754.       hctx = EVP_MD_CTX_create();
755. >     pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_HMAC, NULL,
756.                                           s->session_ctx->ext.cookie_hmac_key,
757.                                           sizeof(s->session_ctx->ext

crypto/evp/p_lib.c:223:1: start of procedure EVP_PKEY_new_raw_private_key()
  221.   }
  222.   
  223. > EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e,
  224.                                          const unsigned char *priv,
  225.                                          size_t len)

crypto/evp/p_lib.c:227:5: Skipping EVP_PKEY_new(): empty list of specs
  225.                                          size_t len)
  226.   {
  227.       EVP_PKEY *ret = EVP_PKEY_new();
             ^
  228.   
  229.       if (ret == NULL

crypto/evp/p_lib.c:229:9: Taking true branch
  227.       EVP_PKEY *ret = EVP_PKEY_new();
  228.   
  229.       if (ret == NULL
                 ^
  230.               || !pkey_set_type(ret, e, type, NULL, -1)) {
  231.           /* EVPerr already called */

crypto/evp/p_lib.c:248:2: 
  246.       return ret;
  247.   
  248. >  err:
  249.       EVP_PKEY_free(ret);
  250.       return NULL;

crypto/evp/p_lib.c:249:5: 
  247.   
  248.    err:
  249. >     EVP_PKEY_free(ret);
  250.       return NULL;
  251.   }

crypto/evp/p_lib.c:529:1: start of procedure EVP_PKEY_free()
    527.   }
    528.   
    529. > void EVP_PKEY_free(EVP_PKEY *x)
    530.   {
    531.       int i;

crypto/evp/p_lib.c:533:9: Taking true branch
    531.       int i;
    532.   
    533.       if (x == NULL)
                   ^
    534.           return;
    535.   

crypto/evp/p_lib.c:534:9: 
    532.   
    533.       if (x == NULL)
    534. >         return;
    535.   
    536.       CRYPTO_DOWN_REF(&x->references, &i, x->lock);

crypto/evp/p_lib.c:545:1: return from a call to EVP_PKEY_free
    543.       sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
    544.       OPENSSL_free(x);
    545. > }
    546.   
    547.   static void EVP_PKEY_free_it(EVP_PKEY *x)

crypto/evp/p_lib.c:250:5: 
  248.    err:
  249.       EVP_PKEY_free(ret);
  250. >     return NULL;
  251.   }
  252.   

crypto/evp/p_lib.c:251:1: return from a call to EVP_PKEY_new_raw_private_key
  249.       EVP_PKEY_free(ret);
  250.       return NULL;
  251. > }
  252.   
  253.   EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e,

ssl/statem/extensions_srvr.c:759:9: Taking false branch
757.                                           sizeof(s->session_ctx->ext
758.                                                  .cookie_hmac_key));
759.       if (hctx == NULL || pkey == NULL) {
               ^
760.           EVP_MD_CTX_free(hctx);
761.           EVP_PKEY_free(pkey);

ssl/statem/extensions_srvr.c:759:25: Taking true branch
757.                                           sizeof(s->session_ctx->ext
758.                                                  .cookie_hmac_key));
759.       if (hctx == NULL || pkey == NULL) {
                               ^
760.           EVP_MD_CTX_free(hctx);
761.           EVP_PKEY_free(pkey);

ssl/statem/extensions_srvr.c:760:9: 
758.                                                  .cookie_hmac_key));
759.       if (hctx == NULL || pkey == NULL) {
760. >         EVP_MD_CTX_free(hctx);
761.           EVP_PKEY_free(pkey);
762.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_CTOS_COOKIE,

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:295:1: start of procedure CRYPTO_free()
    293.   }
    294.   
    295. > void CRYPTO_free(void *str, const char *file, int line)
    296.   {
    297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:298:30: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
                   ^
    300.           return;
    301.       }

crypto/mem.c:300:9: 
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
    300. >         return;
    301.       }
    302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
    312.       free(str);
    313.   #endif
    314. > }
    315.   
    316.   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)
