ssl/t1_lib.c:3099: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_CIPHER_CTX_new()` at line 3002, column 11 is not reachable after line 3099, column 5.
Showing all 55 steps of the trace


ssl/t1_lib.c:2983:1: start of procedure tls_decrypt_ticket()
2981.    *    4: same as 3, but the ticket needs to be renewed.
2982.    */
2983. > static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
2984.                                 int eticklen, const unsigned char *sess_id,
2985.                                 int sesslen, SSL_SESSION **psess)

ssl/t1_lib.c:2990:5: 
2988.       unsigned char *sdec;
2989.       const unsigned char *p;
2990. >     int slen, mlen, renew_ticket = 0, ret = -1;
2991.       unsigned char tick_hmac[EVP_MAX_MD_SIZE];
2992.       HMAC_CTX *hctx = NULL;

ssl/t1_lib.c:2992:5: 
2990.       int slen, mlen, renew_ticket = 0, ret = -1;
2991.       unsigned char tick_hmac[EVP_MAX_MD_SIZE];
2992. >     HMAC_CTX *hctx = NULL;
2993.       EVP_CIPHER_CTX *ctx;
2994.       SSL_CTX *tctx = s->initial_ctx;

ssl/t1_lib.c:2994:5: 
2992.       HMAC_CTX *hctx = NULL;
2993.       EVP_CIPHER_CTX *ctx;
2994. >     SSL_CTX *tctx = s->initial_ctx;
2995.       /* Need at least keyname + iv + some encrypted data */
2996.       if (eticklen < 48)

ssl/t1_lib.c:2996:9: Taking false branch
2994.       SSL_CTX *tctx = s->initial_ctx;
2995.       /* Need at least keyname + iv + some encrypted data */
2996.       if (eticklen < 48)
                ^
2997.           return 2;
2998.       /* Initialize session ticket encryption and HMAC contexts */

ssl/t1_lib.c:2999:5: Skipping HMAC_CTX_new(): empty list of specs
2997.           return 2;
2998.       /* Initialize session ticket encryption and HMAC contexts */
2999.       hctx = HMAC_CTX_new();
            ^
3000.       if (hctx == NULL)
3001.           return -2;

ssl/t1_lib.c:3000:9: Taking false branch
2998.       /* Initialize session ticket encryption and HMAC contexts */
2999.       hctx = HMAC_CTX_new();
3000.       if (hctx == NULL)
                ^
3001.           return -2;
3002.       ctx = EVP_CIPHER_CTX_new();

ssl/t1_lib.c:3002:5: 
3000.       if (hctx == NULL)
3001.           return -2;
3002. >     ctx = EVP_CIPHER_CTX_new();
3003.       if (ctx == NULL) {
3004.           ret = -2;

crypto/evp/evp_enc.c:38:1: start of procedure EVP_CIPHER_CTX_new()
  36.   }
  37.   
  38. > EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  39.   {
  40.       return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));

crypto/evp/evp_enc.c:40:5: 
  38.   EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  39.   {
  40. >     return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  41.   }
  42.   

crypto/mem.c:98:1: start of procedure CRYPTO_zalloc()
    96.   }
    97.   
    98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:100:5: 
    98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100. >     void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)

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/mem.c:102:9: Taking true branch
    100.       void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)
                   ^
    103.           memset(ret, 0, num);
    104.       return ret;

crypto/mem.c:103:9: 
    101.   
    102.       if (ret != NULL)
    103. >         memset(ret, 0, num);
    104.       return ret;
    105.   }

crypto/mem.c:104:5: 
    102.       if (ret != NULL)
    103.           memset(ret, 0, num);
    104. >     return ret;
    105.   }
    106.   

crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
    103.           memset(ret, 0, num);
    104.       return ret;
    105. > }
    106.   
    107.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/evp_enc.c:41:1: return from a call to EVP_CIPHER_CTX_new
  39.   {
  40.       return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  41. > }
  42.   
  43.   void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)

ssl/t1_lib.c:3003:9: Taking false branch
3001.           return -2;
3002.       ctx = EVP_CIPHER_CTX_new();
3003.       if (ctx == NULL) {
                ^
3004.           ret = -2;
3005.           goto err;

ssl/t1_lib.c:3007:9: Taking true branch
3005.           goto err;
3006.       }
3007.       if (tctx->tlsext_ticket_key_cb) {
                ^
3008.           unsigned char *nctick = (unsigned char *)etick;
3009.           int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,

ssl/t1_lib.c:3008:9: 
3006.       }
3007.       if (tctx->tlsext_ticket_key_cb) {
3008. >         unsigned char *nctick = (unsigned char *)etick;
3009.           int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
3010.                                               ctx, hctx, 0);

ssl/t1_lib.c:3009:9: Skipping __function_pointer__(): unresolved function pointer
3007.       if (tctx->tlsext_ticket_key_cb) {
3008.           unsigned char *nctick = (unsigned char *)etick;
3009.           int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
                ^
3010.                                               ctx, hctx, 0);
3011.           if (rv < 0)

ssl/t1_lib.c:3011:13: Taking false branch
3009.           int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
3010.                                               ctx, hctx, 0);
3011.           if (rv < 0)
                    ^
3012.               goto err;
3013.           if (rv == 0) {

ssl/t1_lib.c:3013:13: Taking false branch
3011.           if (rv < 0)
3012.               goto err;
3013.           if (rv == 0) {
                    ^
3014.               ret = 2;
3015.               goto err;

ssl/t1_lib.c:3017:13: Taking false branch
3015.               goto err;
3016.           }
3017.           if (rv == 2)
                    ^
3018.               renew_ticket = 1;
3019.       } else {

ssl/t1_lib.c:3039:5: 
3037.        * checks on ticket.
3038.        */
3039. >     mlen = HMAC_size(hctx);
3040.       if (mlen < 0) {
3041.           goto err;

crypto/hmac/hmac.c:119:1: start of procedure HMAC_size()
  117.   }
  118.   
  119. > size_t HMAC_size(const HMAC_CTX *ctx)
  120.   {
  121.       return EVP_MD_size((ctx)->md);

crypto/hmac/hmac.c:121:5: 
  119.   size_t HMAC_size(const HMAC_CTX *ctx)
  120.   {
  121. >     return EVP_MD_size((ctx)->md);
  122.   }
  123.   

crypto/evp/evp_lib.c:301:1: start of procedure EVP_MD_size()
    299.   }
    300.   
    301. > int EVP_MD_size(const EVP_MD *md)
    302.   {
    303.       if (!md) {

crypto/evp/evp_lib.c:303:10: Taking false branch
    301.   int EVP_MD_size(const EVP_MD *md)
    302.   {
    303.       if (!md) {
                    ^
    304.           EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
    305.           return -1;

crypto/evp/evp_lib.c:307:5: 
    305.           return -1;
    306.       }
    307. >     return md->md_size;
    308.   }
    309.   

crypto/evp/evp_lib.c:308:1: return from a call to EVP_MD_size
    306.       }
    307.       return md->md_size;
    308. > }
    309.   
    310.   unsigned long EVP_MD_flags(const EVP_MD *md)

crypto/hmac/hmac.c:122:1: return from a call to HMAC_size
  120.   {
  121.       return EVP_MD_size((ctx)->md);
  122. > }
  123.   
  124.   HMAC_CTX *HMAC_CTX_new(void)

ssl/t1_lib.c:3040:9: Taking false branch
3038.        */
3039.       mlen = HMAC_size(hctx);
3040.       if (mlen < 0) {
                ^
3041.           goto err;
3042.       }

ssl/t1_lib.c:3043:5: 
3041.           goto err;
3042.       }
3043. >     eticklen -= mlen;
3044.       /* Check HMAC of encrypted ticket */
3045.       if (HMAC_Update(hctx, etick, eticklen) <= 0

ssl/t1_lib.c:3045:9: 
3043.       eticklen -= mlen;
3044.       /* Check HMAC of encrypted ticket */
3045. >     if (HMAC_Update(hctx, etick, eticklen) <= 0
3046.               || HMAC_Final(hctx, tick_hmac, NULL) <= 0) {
3047.           goto err;

crypto/hmac/hmac.c:91:1: start of procedure HMAC_Update()
  89.   #endif
  90.   
  91. > int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
  92.   {
  93.       if (!ctx->md)

crypto/hmac/hmac.c:93:10: Taking false branch
  91.   int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
  92.   {
  93.       if (!ctx->md)
                 ^
  94.           return 0;
  95.       return EVP_DigestUpdate(ctx->md_ctx, data, len);

crypto/hmac/hmac.c:95:5: 
  93.       if (!ctx->md)
  94.           return 0;
  95. >     return EVP_DigestUpdate(ctx->md_ctx, data, len);
  96.   }
  97.   

crypto/evp/digest.c:146:1: start of procedure EVP_DigestUpdate()
    144.   }
    145.   
    146. > int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count)
    147.   {
    148.       return ctx->update(ctx, data, count);

crypto/evp/digest.c:148:5: Skipping __function_pointer__(): unresolved function pointer
    146.   int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count)
    147.   {
    148.       return ctx->update(ctx, data, count);
               ^
    149.   }
    150.   

crypto/evp/digest.c:149:1: return from a call to EVP_DigestUpdate
    147.   {
    148.       return ctx->update(ctx, data, count);
    149. > }
    150.   
    151.   /* The caller can assume that this removes any secret data from the context */

crypto/hmac/hmac.c:96:1: return from a call to HMAC_Update
  94.           return 0;
  95.       return EVP_DigestUpdate(ctx->md_ctx, data, len);
  96. > }
  97.   
  98.   int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)

ssl/t1_lib.c:3045:9: Taking true branch
3043.       eticklen -= mlen;
3044.       /* Check HMAC of encrypted ticket */
3045.       if (HMAC_Update(hctx, etick, eticklen) <= 0
                ^
3046.               || HMAC_Final(hctx, tick_hmac, NULL) <= 0) {
3047.           goto err;

ssl/t1_lib.c:3098:1: 
3096.        */
3097.       return 2;
3098. > err:
3099.       EVP_CIPHER_CTX_free(ctx);
3100.       HMAC_CTX_free(hctx);

ssl/t1_lib.c:3099:5: Skipping EVP_CIPHER_CTX_free(): empty list of specs
3097.       return 2;
3098.   err:
3099.       EVP_CIPHER_CTX_free(ctx);
            ^
3100.       HMAC_CTX_free(hctx);
3101.       return ret;
