ssl/statem/statem_srvr.c:3091: error: MEMORY_LEAK
  memory dynamically allocated by call to `tls_process_cke_psk_preamble()` at line 3064, column 31 is not reachable after line 3091, column 14.
Showing all 52 steps of the trace


ssl/statem/statem_srvr.c:3056:1: start of procedure tls_process_client_key_exchange()
3054.   }
3055.   
3056. > MSG_PROCESS_RETURN tls_process_client_key_exchange(SSL *s, PACKET *pkt)
3057.   {
3058.       int al = -1;

ssl/statem/statem_srvr.c:3058:5: 
3056.   MSG_PROCESS_RETURN tls_process_client_key_exchange(SSL *s, PACKET *pkt)
3057.   {
3058. >     int al = -1;
3059.       unsigned long alg_k;
3060.   

ssl/statem/statem_srvr.c:3061:5: 
3059.       unsigned long alg_k;
3060.   
3061. >     alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
3062.   
3063.       /* For PSK parse and retrieve identity, obtain PSK key */

ssl/statem/statem_srvr.c:3064:10: Taking true branch
3062.   
3063.       /* For PSK parse and retrieve identity, obtain PSK key */
3064.       if ((alg_k & SSL_PSK) && !tls_process_cke_psk_preamble(s, pkt, &al))
                 ^
3065.           goto err;
3066.   

ssl/statem/statem_srvr.c:3064:31: 
3062.   
3063.       /* For PSK parse and retrieve identity, obtain PSK key */
3064. >     if ((alg_k & SSL_PSK) && !tls_process_cke_psk_preamble(s, pkt, &al))
3065.           goto err;
3066.   

ssl/statem/statem_srvr.c:2549:1: start of procedure tls_process_cke_psk_preamble()
  2547.   }
  2548.   
  2549. > static int tls_process_cke_psk_preamble(SSL *s, PACKET *pkt, int *al)
  2550.   {
  2551.   #ifndef OPENSSL_NO_PSK

ssl/statem/statem_srvr.c:2556:10: Taking false branch
  2554.       PACKET psk_identity;
  2555.   
  2556.       if (!PACKET_get_length_prefixed_2(pkt, &psk_identity)) {
                   ^
  2557.           *al = SSL_AD_DECODE_ERROR;
  2558.           SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE, SSL_R_LENGTH_MISMATCH);

ssl/statem/statem_srvr.c:2561:9: 
  2559.           return 0;
  2560.       }
  2561. >     if (PACKET_remaining(&psk_identity) > PSK_MAX_IDENTITY_LEN) {
  2562.           *al = SSL_AD_DECODE_ERROR;
  2563.           SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE, SSL_R_DATA_LENGTH_TOO_LONG);

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/statem_srvr.c:2561:9: Taking false branch
  2559.           return 0;
  2560.       }
  2561.       if (PACKET_remaining(&psk_identity) > PSK_MAX_IDENTITY_LEN) {
                  ^
  2562.           *al = SSL_AD_DECODE_ERROR;
  2563.           SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE, SSL_R_DATA_LENGTH_TOO_LONG);

ssl/statem/statem_srvr.c:2566:9: Taking false branch
  2564.           return 0;
  2565.       }
  2566.       if (s->psk_server_callback == NULL) {
                  ^
  2567.           *al = SSL_AD_INTERNAL_ERROR;
  2568.           SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE, SSL_R_PSK_NO_SERVER_CB);

ssl/statem/statem_srvr.c:2572:10: Taking false branch
  2570.       }
  2571.   
  2572.       if (!PACKET_strndup(&psk_identity, &s->session->psk_identity)) {
                   ^
  2573.           *al = SSL_AD_INTERNAL_ERROR;
  2574.           SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE, ERR_R_INTERNAL_ERROR);

ssl/statem/statem_srvr.c:2578:5: Skipping __function_pointer__(): unresolved function pointer
  2576.       }
  2577.   
  2578.       psklen = s->psk_server_callback(s, s->session->psk_identity,
              ^
  2579.                                       psk, sizeof(psk));
  2580.   

ssl/statem/statem_srvr.c:2581:9: Taking false branch
  2579.                                       psk, sizeof(psk));
  2580.   
  2581.       if (psklen > PSK_MAX_PSK_LEN) {
                  ^
  2582.           *al = SSL_AD_INTERNAL_ERROR;
  2583.           SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE, ERR_R_INTERNAL_ERROR);

ssl/statem/statem_srvr.c:2585:16: Taking false branch
  2583.           SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE, ERR_R_INTERNAL_ERROR);
  2584.           return 0;
  2585.       } else if (psklen == 0) {
                         ^
  2586.           /*
  2587.            * PSK related to the given identity not found

ssl/statem/statem_srvr.c:2595:5: 
  2593.       }
  2594.   
  2595. >     OPENSSL_free(s->s3->tmp.psk);
  2596.       s->s3->tmp.psk = OPENSSL_memdup(psk, psklen);
  2597.       OPENSSL_cleanse(psk, psklen);

crypto/mem.c:264:1: start of procedure CRYPTO_free()
    262.   }
    263.   
    264. > void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

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

crypto/mem.c:280:5: 
    278.       }
    279.   #else
    280. >     free(str);
    281.   #endif
    282.   }

crypto/mem.c:282:1: return from a call to CRYPTO_free
    280.       free(str);
    281.   #endif
    282. > }
    283.   
    284.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

ssl/statem/statem_srvr.c:2596:5: 
  2594.   
  2595.       OPENSSL_free(s->s3->tmp.psk);
  2596. >     s->s3->tmp.psk = OPENSSL_memdup(psk, psklen);
  2597.       OPENSSL_cleanse(psk, psklen);
  2598.   

crypto/o_str.c:60:1: start of procedure CRYPTO_memdup()
    58.   }
    59.   
    60. > void *CRYPTO_memdup(const void *data, size_t siz, const char* file, int line)
    61.   {
    62.       void *ret;

crypto/o_str.c:64:9: Taking false branch
    62.       void *ret;
    63.   
    64.       if (data == NULL || siz >= INT_MAX)
                  ^
    65.           return NULL;
    66.   

crypto/o_str.c:64:25: Taking false branch
    62.       void *ret;
    63.   
    64.       if (data == NULL || siz >= INT_MAX)
                                  ^
    65.           return NULL;
    66.   

crypto/o_str.c:67:5: 
    65.           return NULL;
    66.   
    67. >     ret = CRYPTO_malloc(siz, file, line);
    68.       if (ret == NULL) {
    69.           CRYPTOerr(CRYPTO_F_CRYPTO_MEMDUP, ERR_R_MALLOC_FAILURE);

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

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

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

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

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

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

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

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

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

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

crypto/o_str.c:68:9: Taking false branch
    66.   
    67.       ret = CRYPTO_malloc(siz, file, line);
    68.       if (ret == NULL) {
                  ^
    69.           CRYPTOerr(CRYPTO_F_CRYPTO_MEMDUP, ERR_R_MALLOC_FAILURE);
    70.           return NULL;

crypto/o_str.c:72:5: 
    70.           return NULL;
    71.       }
    72. >     return memcpy(ret, data, siz);
    73.   }
    74.   

crypto/o_str.c:73:1: return from a call to CRYPTO_memdup
    71.       }
    72.       return memcpy(ret, data, siz);
    73. > }
    74.   
    75.   size_t OPENSSL_strnlen(const char *str, size_t maxlen)

ssl/statem/statem_srvr.c:2597:5: Skipping OPENSSL_cleanse(): method has no implementation
  2595.       OPENSSL_free(s->s3->tmp.psk);
  2596.       s->s3->tmp.psk = OPENSSL_memdup(psk, psklen);
  2597.       OPENSSL_cleanse(psk, psklen);
              ^
  2598.   
  2599.       if (s->s3->tmp.psk == NULL) {

ssl/statem/statem_srvr.c:2599:9: Taking false branch
  2597.       OPENSSL_cleanse(psk, psklen);
  2598.   
  2599.       if (s->s3->tmp.psk == NULL) {
                  ^
  2600.           *al = SSL_AD_INTERNAL_ERROR;
  2601.           SSLerr(SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE, ERR_R_MALLOC_FAILURE);

ssl/statem/statem_srvr.c:2605:5: 
  2603.       }
  2604.   
  2605. >     s->s3->tmp.psklen = psklen;
  2606.   
  2607.       return 1;

ssl/statem/statem_srvr.c:2607:5: 
  2605.       s->s3->tmp.psklen = psklen;
  2606.   
  2607. >     return 1;
  2608.   #else
  2609.       /* Should never happen */

ssl/statem/statem_srvr.c:2614:1: return from a call to tls_process_cke_psk_preamble
  2612.       return 0;
  2613.   #endif
  2614. > }
  2615.   
  2616.   static int tls_process_cke_rsa(SSL *s, PACKET *pkt, int *al)

ssl/statem/statem_srvr.c:3064:31: Taking false branch
3062.   
3063.       /* For PSK parse and retrieve identity, obtain PSK key */
3064.       if ((alg_k & SSL_PSK) && !tls_process_cke_psk_preamble(s, pkt, &al))
                                      ^
3065.           goto err;
3066.   

ssl/statem/statem_srvr.c:3067:9: Taking false branch
3065.           goto err;
3066.   
3067.       if (alg_k & SSL_kPSK) {
                ^
3068.           /* Identity extracted earlier: should be nothing left */
3069.           if (PACKET_remaining(pkt) != 0) {

ssl/statem/statem_srvr.c:3081:16: Taking false branch
3079.               goto err;
3080.           }
3081.       } else if (alg_k & (SSL_kRSA | SSL_kRSAPSK)) {
                       ^
3082.           if (!tls_process_cke_rsa(s, pkt, &al))
3083.               goto err;

ssl/statem/statem_srvr.c:3084:16: Taking false branch
3082.           if (!tls_process_cke_rsa(s, pkt, &al))
3083.               goto err;
3084.       } else if (alg_k & (SSL_kDHE | SSL_kDHEPSK)) {
                       ^
3085.           if (!tls_process_cke_dhe(s, pkt, &al))
3086.               goto err;

ssl/statem/statem_srvr.c:3087:16: Taking false branch
3085.           if (!tls_process_cke_dhe(s, pkt, &al))
3086.               goto err;
3087.       } else if (alg_k & (SSL_kECDHE | SSL_kECDHEPSK)) {
                       ^
3088.           if (!tls_process_cke_ecdhe(s, pkt, &al))
3089.               goto err;

ssl/statem/statem_srvr.c:3090:16: Taking true branch
3088.           if (!tls_process_cke_ecdhe(s, pkt, &al))
3089.               goto err;
3090.       } else if (alg_k & SSL_kSRP) {
                       ^
3091.           if (!tls_process_cke_srp(s, pkt, &al))
3092.               goto err;

ssl/statem/statem_srvr.c:3091:14: Skipping tls_process_cke_srp(): empty list of specs
3089.               goto err;
3090.       } else if (alg_k & SSL_kSRP) {
3091.           if (!tls_process_cke_srp(s, pkt, &al))
                     ^
3092.               goto err;
3093.       } else if (alg_k & SSL_kGOST) {
