ssl/t1_lib.c:3016: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `HMAC_CTX_new()` at line 2999, column 12 is not reachable after line 3016, column 13.
Showing all 52 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;
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;
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: 
2997.           return 2;
2998.       /* Initialize session ticket encryption and HMAC contexts */
2999. >     hctx = HMAC_CTX_new();
3000.       if (hctx == NULL)
3001.           return -2;

crypto/hmac/hmac.c:172:1: start of procedure HMAC_CTX_new()
  170.   }
  171.   
  172. > HMAC_CTX *HMAC_CTX_new(void)
  173.   {
  174.       HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));

crypto/hmac/hmac.c:174:5: 
  172.   HMAC_CTX *HMAC_CTX_new(void)
  173.   {
  174. >     HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));
  175.   
  176.       if (ctx != NULL) {

crypto/mem.c:159:1: start of procedure CRYPTO_zalloc()
    157.   }
    158.   
    159. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    160.   {
    161.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:161:5: 
    159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    160.   {
    161. >     void *ret = CRYPTO_malloc(num, file, line);
    162.   
    163.       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. >     (void)file;
      140.       (void)line;
      141.       ret = malloc(num);

crypto/mem.c:140:5: 
      138.   #else
      139.       (void)file;
      140. >     (void)line;
      141.       ret = malloc(num);
      142.   #endif

crypto/mem.c:141:5: 
      139.       (void)file;
      140.       (void)line;
      141. >     ret = malloc(num);
      142.   #endif
      143.   

crypto/mem.c:156:5: 
      154.   #endif
      155.   
      156. >     return ret;
      157.   }
      158.   

crypto/mem.c:157:1: return from a call to CRYPTO_malloc
      155.   
      156.       return ret;
      157. > }
      158.   
      159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:163:9: Taking true branch
    161.       void *ret = CRYPTO_malloc(num, file, line);
    162.   
    163.       if (ret != NULL)
                   ^
    164.           memset(ret, 0, num);
    165.       return ret;

crypto/mem.c:164:9: 
    162.   
    163.       if (ret != NULL)
    164. >         memset(ret, 0, num);
    165.       return ret;
    166.   }

crypto/mem.c:165:5: 
    163.       if (ret != NULL)
    164.           memset(ret, 0, num);
    165. >     return ret;
    166.   }
    167.   

crypto/mem.c:166:1: return from a call to CRYPTO_zalloc
    164.           memset(ret, 0, num);
    165.       return ret;
    166. > }
    167.   
    168.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/hmac/hmac.c:176:9: Taking true branch
  174.       HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX));
  175.   
  176.       if (ctx != NULL) {
                 ^
  177.           if (!HMAC_CTX_reset(ctx)) {
  178.               HMAC_CTX_free(ctx);

crypto/hmac/hmac.c:177:14: Taking false branch
  175.   
  176.       if (ctx != NULL) {
  177.           if (!HMAC_CTX_reset(ctx)) {
                      ^
  178.               HMAC_CTX_free(ctx);
  179.               return NULL;

crypto/hmac/hmac.c:182:5: 
  180.           }
  181.       }
  182. >     return ctx;
  183.   }
  184.   

crypto/hmac/hmac.c:183:1: return from a call to HMAC_CTX_new
  181.       }
  182.       return ctx;
  183. > }
  184.   
  185.   static void hmac_ctx_cleanup(HMAC_CTX *ctx)

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 (tctx->tlsext_ticket_key_cb) {
3004.           unsigned char *nctick = (unsigned char *)etick;

crypto/evp/evp_enc.c:93:1: start of procedure EVP_CIPHER_CTX_new()
  91.   }
  92.   
  93. > EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  94.   {
  95.       return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));

crypto/evp/evp_enc.c:95:5: 
  93.   EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  94.   {
  95. >     return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  96.   }
  97.   

crypto/mem.c:159:1: start of procedure CRYPTO_zalloc()
    157.   }
    158.   
    159. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    160.   {
    161.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:161:5: 
    159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    160.   {
    161. >     void *ret = CRYPTO_malloc(num, file, line);
    162.   
    163.       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. >     (void)file;
      140.       (void)line;
      141.       ret = malloc(num);

crypto/mem.c:140:5: 
      138.   #else
      139.       (void)file;
      140. >     (void)line;
      141.       ret = malloc(num);
      142.   #endif

crypto/mem.c:141:5: 
      139.       (void)file;
      140.       (void)line;
      141. >     ret = malloc(num);
      142.   #endif
      143.   

crypto/mem.c:156:5: 
      154.   #endif
      155.   
      156. >     return ret;
      157.   }
      158.   

crypto/mem.c:157:1: return from a call to CRYPTO_malloc
      155.   
      156.       return ret;
      157. > }
      158.   
      159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:163:9: Taking true branch
    161.       void *ret = CRYPTO_malloc(num, file, line);
    162.   
    163.       if (ret != NULL)
                   ^
    164.           memset(ret, 0, num);
    165.       return ret;

crypto/mem.c:164:9: 
    162.   
    163.       if (ret != NULL)
    164. >         memset(ret, 0, num);
    165.       return ret;
    166.   }

crypto/mem.c:165:5: 
    163.       if (ret != NULL)
    164.           memset(ret, 0, num);
    165. >     return ret;
    166.   }
    167.   

crypto/mem.c:166:1: return from a call to CRYPTO_zalloc
    164.           memset(ret, 0, num);
    165.       return ret;
    166. > }
    167.   
    168.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/evp_enc.c:96:1: return from a call to EVP_CIPHER_CTX_new
  94.   {
  95.       return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  96. > }
  97.   
  98.   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 (tctx->tlsext_ticket_key_cb) {
                ^
3004.           unsigned char *nctick = (unsigned char *)etick;
3005.           int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,

ssl/t1_lib.c:3015:13: Taking true branch
3013.       } else {
3014.           /* Check key name matches */
3015.           if (memcmp(etick, tctx->tlsext_tick_key_name, 16))
                    ^
3016.               return 2;
3017.           if (HMAC_Init_ex(hctx, tctx->tlsext_tick_hmac_key, 16,

ssl/t1_lib.c:3016:13: 
3014.           /* Check key name matches */
3015.           if (memcmp(etick, tctx->tlsext_tick_key_name, 16))
3016. >             return 2;
3017.           if (HMAC_Init_ex(hctx, tctx->tlsext_tick_hmac_key, 16,
3018.                            EVP_sha256(), NULL) <= 0
