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


crypto/bio/b_addr.c:543:1: start of procedure addrinfo_wrap()
541.    * only happens if a memory allocation error occured.
542.    */
543. > static int addrinfo_wrap(int family, int socktype,
544.                            const void *where, size_t wherelen,
545.                            unsigned short port,

crypto/bio/b_addr.c:548:5: Condition is true
546.                            BIO_ADDRINFO **bai)
547.   {
548.       OPENSSL_assert(bai != NULL);
           ^
549.   
550.       *bai = (BIO_ADDRINFO *)OPENSSL_zalloc(sizeof(**bai));

crypto/bio/b_addr.c:550:5: 
548.       OPENSSL_assert(bai != NULL);
549.   
550. >     *bai = (BIO_ADDRINFO *)OPENSSL_zalloc(sizeof(**bai));
551.   
552.       if (*bai == NULL)

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

crypto/mem.c:158:5: 
  156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  157.   {
  158. >     void *ret = CRYPTO_malloc(num, file, line);
  159.   
  160.       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 (num <= 0)

crypto/mem.c:123:9: Taking false branch
    121.       void *ret = NULL;
    122.   
    123.       if (num <= 0)
                   ^
    124.           return NULL;
    125.   

crypto/mem.c:126:5: 
    124.           return NULL;
    125.   
    126. >     allow_customize = 0;
    127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
    134.       }
    135.   #else
    136. >     (void)file;
    137.       (void)line;
    138.       ret = malloc(num);

crypto/mem.c:137:5: 
    135.   #else
    136.       (void)file;
    137. >     (void)line;
    138.       ret = malloc(num);
    139.   #endif

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

crypto/mem.c:153:5: 
    151.   #endif
    152.   
    153. >     return ret;
    154.   }
    155.   

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

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

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

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

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

crypto/bio/b_addr.c:552:9: Taking false branch
550.       *bai = (BIO_ADDRINFO *)OPENSSL_zalloc(sizeof(**bai));
551.   
552.       if (*bai == NULL)
               ^
553.           return 0;
554.       (*bai)->bai_family = family;

crypto/bio/b_addr.c:554:5: 
552.       if (*bai == NULL)
553.           return 0;
554. >     (*bai)->bai_family = family;
555.       (*bai)->bai_socktype = socktype;
556.       if (socktype == SOCK_STREAM)

crypto/bio/b_addr.c:555:5: 
553.           return 0;
554.       (*bai)->bai_family = family;
555. >     (*bai)->bai_socktype = socktype;
556.       if (socktype == SOCK_STREAM)
557.           (*bai)->bai_protocol = IPPROTO_TCP;

crypto/bio/b_addr.c:556:9: Taking false branch
554.       (*bai)->bai_family = family;
555.       (*bai)->bai_socktype = socktype;
556.       if (socktype == SOCK_STREAM)
               ^
557.           (*bai)->bai_protocol = IPPROTO_TCP;
558.       if (socktype == SOCK_DGRAM)

crypto/bio/b_addr.c:558:9: Taking false branch
556.       if (socktype == SOCK_STREAM)
557.           (*bai)->bai_protocol = IPPROTO_TCP;
558.       if (socktype == SOCK_DGRAM)
               ^
559.           (*bai)->bai_protocol = IPPROTO_UDP;
560.   #ifdef AF_UNIX

crypto/bio/b_addr.c:561:9: Taking false branch
559.           (*bai)->bai_protocol = IPPROTO_UDP;
560.   #ifdef AF_UNIX
561.       if (family == AF_UNIX)
               ^
562.           (*bai)->bai_protocol = 0;
563.   #endif

crypto/bio/b_addr.c:570:9: 
568.              creating a memory leak here, we are not.  It will be
569.              all right. */
570. >         BIO_ADDR *addr = BIO_ADDR_new();
571.           if (addr != NULL) {
572.               BIO_ADDR_rawmake(addr, family, where, wherelen, port);

crypto/bio/b_addr.c:76:1: start of procedure BIO_ADDR_new()
  74.    */
  75.   
  76. > BIO_ADDR *BIO_ADDR_new(void)
  77.   {
  78.       BIO_ADDR *ret = (BIO_ADDR *)OPENSSL_zalloc(sizeof(BIO_ADDR));

crypto/bio/b_addr.c:78:5: 
  76.   BIO_ADDR *BIO_ADDR_new(void)
  77.   {
  78. >     BIO_ADDR *ret = (BIO_ADDR *)OPENSSL_zalloc(sizeof(BIO_ADDR));
  79.       return ret;
  80.   }

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

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       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 (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

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

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

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

crypto/mem.c:160:9: Taking false branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

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

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

crypto/bio/b_addr.c:79:5: 
  77.   {
  78.       BIO_ADDR *ret = (BIO_ADDR *)OPENSSL_zalloc(sizeof(BIO_ADDR));
  79. >     return ret;
  80.   }
  81.   

crypto/bio/b_addr.c:80:1: return from a call to BIO_ADDR_new
  78.       BIO_ADDR *ret = (BIO_ADDR *)OPENSSL_zalloc(sizeof(BIO_ADDR));
  79.       return ret;
  80. > }
  81.   
  82.   void BIO_ADDR_free(BIO_ADDR *ap)

crypto/bio/b_addr.c:571:13: Taking false branch
569.              all right. */
570.           BIO_ADDR *addr = BIO_ADDR_new();
571.           if (addr != NULL) {
                   ^
572.               BIO_ADDR_rawmake(addr, family, where, wherelen, port);
573.               (*bai)->bai_addr = BIO_ADDR_sockaddr_noconst(addr);

crypto/bio/b_addr.c:576:5: 
574.           }
575.       }
576. >     (*bai)->bai_next = NULL;
577.       if ((*bai)->bai_addr == NULL) {
578.           BIO_ADDRINFO_free(*bai);

crypto/bio/b_addr.c:577:9: Taking true branch
575.       }
576.       (*bai)->bai_next = NULL;
577.       if ((*bai)->bai_addr == NULL) {
               ^
578.           BIO_ADDRINFO_free(*bai);
579.           *bai = NULL;

crypto/bio/b_addr.c:578:9: Skipping BIO_ADDRINFO_free(): empty list of specs
576.       (*bai)->bai_next = NULL;
577.       if ((*bai)->bai_addr == NULL) {
578.           BIO_ADDRINFO_free(*bai);
               ^
579.           *bai = NULL;
580.           return 0;

crypto/bio/b_addr.c:579:9: 
577.       if ((*bai)->bai_addr == NULL) {
578.           BIO_ADDRINFO_free(*bai);
579. >         *bai = NULL;
580.           return 0;
581.       }

static int addrinfo_wrap(int family, int socktype,
                         const void *where, size_t wherelen,
                         unsigned short port,
                         BIO_ADDRINFO **bai)
{
    OPENSSL_assert(bai != NULL);
    *bai = (BIO_ADDRINFO *)OPENSSL_zalloc(sizeof(**bai));
    if (*bai == NULL)
        return 0;
    (*bai)->bai_family = family;
    (*bai)->bai_socktype = socktype;
    if (socktype == SOCK_STREAM)
        (*bai)->bai_protocol = IPPROTO_TCP;
    if (socktype == SOCK_DGRAM)
        (*bai)->bai_protocol = IPPROTO_UDP;
#ifdef AF_UNIX
    if (family == AF_UNIX)
        (*bai)->bai_protocol = 0;
#endif
    {
        BIO_ADDR *addr = BIO_ADDR_new();
        if (addr != NULL) {
            BIO_ADDR_rawmake(addr, family, where, wherelen, port);
            (*bai)->bai_addr = BIO_ADDR_sockaddr_noconst(addr);
        }
    }
    (*bai)->bai_next = NULL;
    if ((*bai)->bai_addr == NULL) {
        BIO_ADDRINFO_free(*bai);
        *bai = NULL;
        return 0;
    }
    return 1;
}
['static int addrinfo_wrap(int family, int socktype,\n                         const void *where, size_t wherelen,\n                         unsigned short port,\n                         BIO_ADDRINFO **bai)\n{\n    OPENSSL_assert(bai != NULL);\n    *bai = (BIO_ADDRINFO *)OPENSSL_zalloc(sizeof(**bai));\n    if (*bai == NULL)\n        return 0;\n    (*bai)->bai_family = family;\n    (*bai)->bai_socktype = socktype;\n    if (socktype == SOCK_STREAM)\n        (*bai)->bai_protocol = IPPROTO_TCP;\n    if (socktype == SOCK_DGRAM)\n        (*bai)->bai_protocol = IPPROTO_UDP;\n#ifdef AF_UNIX\n    if (family == AF_UNIX)\n        (*bai)->bai_protocol = 0;\n#endif\n    {\n        BIO_ADDR *addr = BIO_ADDR_new();\n        if (addr != NULL) {\n            BIO_ADDR_rawmake(addr, family, where, wherelen, port);\n            (*bai)->bai_addr = BIO_ADDR_sockaddr_noconst(addr);\n        }\n    }\n    (*bai)->bai_next = NULL;\n    if ((*bai)->bai_addr == NULL) {\n        BIO_ADDRINFO_free(*bai);\n        *bai = NULL;\n        return 0;\n    }\n    return 1;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'BIO_ADDR *BIO_ADDR_new(void)\n{\n    BIO_ADDR *ret = (BIO_ADDR *)OPENSSL_zalloc(sizeof(BIO_ADDR));\n    return ret;\n}']