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


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

ssl/t1_lib.c:2972:5: 
2970.       unsigned char *sdec;
2971.       const unsigned char *p;
2972. >     int slen, mlen, renew_ticket = 0, ret = -1;
2973.       unsigned char tick_hmac[EVP_MAX_MD_SIZE];
2974.       HMAC_CTX *hctx = NULL;

ssl/t1_lib.c:2974:5: 
2972.       int slen, mlen, renew_ticket = 0, ret = -1;
2973.       unsigned char tick_hmac[EVP_MAX_MD_SIZE];
2974. >     HMAC_CTX *hctx = NULL;
2975.       EVP_CIPHER_CTX *ctx;
2976.       SSL_CTX *tctx = s->initial_ctx;

ssl/t1_lib.c:2976:5: 
2974.       HMAC_CTX *hctx = NULL;
2975.       EVP_CIPHER_CTX *ctx;
2976. >     SSL_CTX *tctx = s->initial_ctx;
2977.       /* Need at least keyname + iv + some encrypted data */
2978.       if (eticklen < 48)

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

ssl/t1_lib.c:2981:5: Skipping HMAC_CTX_new(): empty list of specs
2979.           return 2;
2980.       /* Initialize session ticket encryption and HMAC contexts */
2981.       hctx = HMAC_CTX_new();
            ^
2982.       if (hctx == NULL)
2983.           return -2;

ssl/t1_lib.c:2982:9: Taking false branch
2980.       /* Initialize session ticket encryption and HMAC contexts */
2981.       hctx = HMAC_CTX_new();
2982.       if (hctx == NULL)
                ^
2983.           return -2;
2984.       ctx = EVP_CIPHER_CTX_new();

ssl/t1_lib.c:2984:5: 
2982.       if (hctx == NULL)
2983.           return -2;
2984. >     ctx = EVP_CIPHER_CTX_new();
2985.       if (ctx == NULL) {
2986.           ret = -2;

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

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

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:42:1: return from a call to EVP_CIPHER_CTX_new
  40.   {
  41.       return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  42. > }
  43.   
  44.   void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)

ssl/t1_lib.c:2985:9: Taking false branch
2983.           return -2;
2984.       ctx = EVP_CIPHER_CTX_new();
2985.       if (ctx == NULL) {
                ^
2986.           ret = -2;
2987.           goto err;

ssl/t1_lib.c:2989:9: Taking true branch
2987.           goto err;
2988.       }
2989.       if (tctx->tlsext_ticket_key_cb) {
                ^
2990.           unsigned char *nctick = (unsigned char *)etick;
2991.           int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,

ssl/t1_lib.c:2990:9: 
2988.       }
2989.       if (tctx->tlsext_ticket_key_cb) {
2990. >         unsigned char *nctick = (unsigned char *)etick;
2991.           int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
2992.                                               ctx, hctx, 0);

ssl/t1_lib.c:2991:9: Skipping __function_pointer__(): unresolved function pointer
2989.       if (tctx->tlsext_ticket_key_cb) {
2990.           unsigned char *nctick = (unsigned char *)etick;
2991.           int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
                ^
2992.                                               ctx, hctx, 0);
2993.           if (rv < 0)

ssl/t1_lib.c:2993:13: Taking false branch
2991.           int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
2992.                                               ctx, hctx, 0);
2993.           if (rv < 0)
                    ^
2994.               goto err;
2995.           if (rv == 0) {

ssl/t1_lib.c:2995:13: Taking false branch
2993.           if (rv < 0)
2994.               goto err;
2995.           if (rv == 0) {
                    ^
2996.               ret = 2;
2997.               goto err;

ssl/t1_lib.c:2999:13: Taking false branch
2997.               goto err;
2998.           }
2999.           if (rv == 2)
                    ^
3000.               renew_ticket = 1;
3001.       } else {

ssl/t1_lib.c:3021:5: 
3019.        * checks on ticket.
3020.        */
3021. >     mlen = HMAC_size(hctx);
3022.       if (mlen < 0) {
3023.           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:3022:9: Taking false branch
3020.        */
3021.       mlen = HMAC_size(hctx);
3022.       if (mlen < 0) {
                ^
3023.           goto err;
3024.       }

ssl/t1_lib.c:3025:5: 
3023.           goto err;
3024.       }
3025. >     eticklen -= mlen;
3026.       /* Check HMAC of encrypted ticket */
3027.       if (HMAC_Update(hctx, etick, eticklen) <= 0

ssl/t1_lib.c:3027:9: 
3025.       eticklen -= mlen;
3026.       /* Check HMAC of encrypted ticket */
3027. >     if (HMAC_Update(hctx, etick, eticklen) <= 0
3028.               || HMAC_Final(hctx, tick_hmac, NULL) <= 0) {
3029.           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:3027:9: Taking true branch
3025.       eticklen -= mlen;
3026.       /* Check HMAC of encrypted ticket */
3027.       if (HMAC_Update(hctx, etick, eticklen) <= 0
                ^
3028.               || HMAC_Final(hctx, tick_hmac, NULL) <= 0) {
3029.           goto err;

ssl/t1_lib.c:3080:1: 
3078.        */
3079.       return 2;
3080. > err:
3081.       EVP_CIPHER_CTX_free(ctx);
3082.       HMAC_CTX_free(hctx);

ssl/t1_lib.c:3081:5: Skipping EVP_CIPHER_CTX_free(): empty list of specs
3079.       return 2;
3080.   err:
3081.       EVP_CIPHER_CTX_free(ctx);
            ^
3082.       HMAC_CTX_free(hctx);
3083.       return ret;
