crypto/bio/b_addr.c:598: error: MEMORY_LEAK
  memory dynamically allocated to `*bai` by call to `CRYPTO_zalloc()` at line 569, column 12 is not reachable after line 598, column 9.
Showing all 31 steps of the trace


crypto/bio/b_addr.c:562:1: start of procedure addrinfo_wrap()
560.    * only happens if a memory allocation error occurred.
561.    */
562. > static int addrinfo_wrap(int family, int socktype,
563.                            const void *where, size_t wherelen,
564.                            unsigned short port,

crypto/bio/b_addr.c:567:5: Condition is true
565.                            BIO_ADDRINFO **bai)
566.   {
567.       OPENSSL_assert(bai != NULL);
           ^
568.   
569.       *bai = OPENSSL_zalloc(sizeof(**bai));

crypto/bio/b_addr.c:569:5: 
567.       OPENSSL_assert(bai != NULL);
568.   
569. >     *bai = OPENSSL_zalloc(sizeof(**bai));
570.       if (*bai == NULL)
571.           return 0;

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/bio/b_addr.c:570:9: Taking false branch
568.   
569.       *bai = OPENSSL_zalloc(sizeof(**bai));
570.       if (*bai == NULL)
               ^
571.           return 0;
572.   

crypto/bio/b_addr.c:573:5: 
571.           return 0;
572.   
573. >     (*bai)->bai_family = family;
574.       (*bai)->bai_socktype = socktype;
575.       if (socktype == SOCK_STREAM)

crypto/bio/b_addr.c:574:5: 
572.   
573.       (*bai)->bai_family = family;
574. >     (*bai)->bai_socktype = socktype;
575.       if (socktype == SOCK_STREAM)
576.           (*bai)->bai_protocol = IPPROTO_TCP;

crypto/bio/b_addr.c:575:9: Taking false branch
573.       (*bai)->bai_family = family;
574.       (*bai)->bai_socktype = socktype;
575.       if (socktype == SOCK_STREAM)
               ^
576.           (*bai)->bai_protocol = IPPROTO_TCP;
577.       if (socktype == SOCK_DGRAM)

crypto/bio/b_addr.c:577:9: Taking false branch
575.       if (socktype == SOCK_STREAM)
576.           (*bai)->bai_protocol = IPPROTO_TCP;
577.       if (socktype == SOCK_DGRAM)
               ^
578.           (*bai)->bai_protocol = IPPROTO_UDP;
579.   #ifdef AF_UNIX

crypto/bio/b_addr.c:580:9: Taking false branch
578.           (*bai)->bai_protocol = IPPROTO_UDP;
579.   #ifdef AF_UNIX
580.       if (family == AF_UNIX)
               ^
581.           (*bai)->bai_protocol = 0;
582.   #endif

crypto/bio/b_addr.c:589:9: Skipping BIO_ADDR_new(): empty list of specs
587.              creating a memory leak here, we are not.  It will be
588.              all right. */
589.           BIO_ADDR *addr = BIO_ADDR_new();
               ^
590.           if (addr != NULL) {
591.               BIO_ADDR_rawmake(addr, family, where, wherelen, port);

crypto/bio/b_addr.c:590:13: Taking false branch
588.              all right. */
589.           BIO_ADDR *addr = BIO_ADDR_new();
590.           if (addr != NULL) {
                   ^
591.               BIO_ADDR_rawmake(addr, family, where, wherelen, port);
592.               (*bai)->bai_addr = BIO_ADDR_sockaddr_noconst(addr);

crypto/bio/b_addr.c:595:5: 
593.           }
594.       }
595. >     (*bai)->bai_next = NULL;
596.       if ((*bai)->bai_addr == NULL) {
597.           BIO_ADDRINFO_free(*bai);

crypto/bio/b_addr.c:596:9: Taking true branch
594.       }
595.       (*bai)->bai_next = NULL;
596.       if ((*bai)->bai_addr == NULL) {
               ^
597.           BIO_ADDRINFO_free(*bai);
598.           *bai = NULL;

crypto/bio/b_addr.c:597:9: Skipping BIO_ADDRINFO_free(): empty list of specs
595.       (*bai)->bai_next = NULL;
596.       if ((*bai)->bai_addr == NULL) {
597.           BIO_ADDRINFO_free(*bai);
               ^
598.           *bai = NULL;
599.           return 0;

crypto/bio/b_addr.c:598:9: 
596.       if ((*bai)->bai_addr == NULL) {
597.           BIO_ADDRINFO_free(*bai);
598. >         *bai = NULL;
599.           return 0;
600.       }
