is getaddrinfo memory leak? - Linux

This is a discussion on is getaddrinfo memory leak? - Linux ; hi all: my program use getaddrinfo ,but when i use valgrind check memory leak it show getaddrinfo memory leak code: int checkAddrType(const char *addr,const char *hostip) { struct sockaddr_in ad,*adp; struct addrinfo hints,*result; char buf[100]; if(inet_pton(PF_INET,addr,&ad.sin_addr) { memset(&hints,0,sizeof(hints)); hints.ai_family=PF_UNSPEC; hints.ai_socktype=SOCK_STREAM; ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: is getaddrinfo memory leak?

  1. is getaddrinfo memory leak?

    hi all:
    my program use getaddrinfo ,but when i use valgrind check memory
    leak it show getaddrinfo memory leak
    code:
    int checkAddrType(const char *addr,const char *hostip)
    {
    struct sockaddr_in ad,*adp;
    struct addrinfo hints,*result;
    char buf[100];

    if(inet_pton(PF_INET,addr,&ad.sin_addr)<=0)
    {
    memset(&hints,0,sizeof(hints));
    hints.ai_family=PF_UNSPEC;
    hints.ai_socktype=SOCK_STREAM;
    if(getaddrinfo(addr,"www",&hints,&result)!=0)
    {
    return -1;
    }

    adp=(struct sockaddr_in *)result->ai_addr;
    inet_ntop(PF_INET,&adp->sin_addr,buf,100);
    freeaddrinfo(result);
    if(compIp(buf,hostip)==0)
    return 2;
    return 3;

    }

    if(compIp(addr,hostip)==0)
    return 1;

    return 0;
    }
    test code:

    #include

    int main(int argc,char **argv)
    {

    int i;

    for(i=0;i<1000;i++)
    {
    checkAddrType("www.zju.edu.cn","10.10.8.22");
    }

    return 0;
    }

    valgrind check log:
    ==11044== Memcheck, a memory error detector.
    ==11044== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et
    al.
    ==11044== Using LibVEX rev 1606, a library for dynamic binary
    translation.
    ==11044== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
    ==11044== Using valgrind-3.2.0-Debian, a dynamic binary
    instrumentation framework.
    ==11044== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et
    al.
    ==11044== For more details, rerun with: -v
    ==11044==
    --11044-- DWARF2 CFI reader: unhandled CFI instruction 0:50
    --11044-- DWARF2 CFI reader: unhandled CFI instruction 0:50
    --11044-- DWARF2 CFI reader: unhandled CFI instruction 0:50
    --11044-- DWARF2 CFI reader: unhandled CFI instruction 0:50
    ==11044== Invalid read of size 4
    ==11044== at 0x40114D0: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4004E29: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4006B55: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400A576: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400AB31: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4193BFB: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    libc-2.3.6.so)
    ==11044== Address 0x41C6E50 is 24 bytes inside a block of size 27
    alloc'd
    ==11044== at 0x401C4A1: malloc (vg_replace_malloc.c:149)
    ==11044== by 0x4006DF0: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400A576: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400AB31: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4193BFB: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    libc-2.3.6.so)
    ==11044==
    ==11044== Invalid read of size 4
    ==11044== at 0x40114B9: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4004E29: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4006B55: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400A576: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400AB31: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4193BFB: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    libc-2.3.6.so)
    ==11044== Address 0x41C717C is 20 bytes inside a block of size 22
    alloc'd
    ==11044== at 0x401C4A1: malloc (vg_replace_malloc.c:149)
    ==11044== by 0x4006DF0: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400A576: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x400AB31: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4193BFB: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    libc-2.3.6.so)
    ==11044==
    ==11044== Conditional jump or move depends on uninitialised value(s)
    ==11044== at 0x4009313: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4193EA9: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x417048E: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4171DCF: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x417669D: getservbyname_r (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4144C42: (within /lib/tls/libc-2.3.6.so)
    ==11044==
    ==11044== Conditional jump or move depends on uninitialised value(s)
    ==11044== at 0x4008FB0: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4193EA9: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x417048E: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4171DCF: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x417669D: getservbyname_r (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4144C42: (within /lib/tls/libc-2.3.6.so)
    ==11044==
    ==11044== Invalid read of size 4
    ==11044== at 0x40114D0: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4004E29: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4006B55: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4193B9F: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x4145E36: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4146855: getaddrinfo (in /lib/tls/libc-2.3.6.so)
    ==11044== Address 0x41C8CC0 is 24 bytes inside a block of size 25
    alloc'd
    ==11044== at 0x401C4A1: malloc (vg_replace_malloc.c:149)
    ==11044== by 0x4006DF0: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4193B9F: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    libc-2.3.6.so)
    ==11044== by 0x4145E36: (within /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4146855: getaddrinfo (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x80486FE: checkAddrType (addressinfo.c:71)
    ==11044==
    ==11044== ERROR SUMMARY: 13 errors from 5 contexts (suppressed: 17
    from 1)
    ==11044== malloc/free: in use at exit: 26,000 bytes in 1,000 blocks.
    ==11044== malloc/free: 17,067 allocs, 16,067 frees, 3,637,948 bytes
    allocated.
    ==11044== For counts of detected errors, rerun with: -v
    ==11044== searching for pointers to 1,000 not-freed blocks.
    ==11044== checked 92,612 bytes.
    ==11044==
    ==11044==
    ==11044== 26,000 bytes in 1,000 blocks are definitely lost in loss
    record 1 of 1
    ==11044== at 0x401C4A1: malloc (vg_replace_malloc.c:149)
    ==11044== by 0x439A5BF: ???
    ==11044== by 0x439A656: ???
    ==11044== by 0x4373483: ???
    ==11044== by 0x436C8B4: ???
    ==11044== by 0x436CE92: ???
    ==11044== by 0x42C972D: ???
    ==11044== by 0x42C9817: ???
    ==11044== by 0x42C8F95: ???
    ==11044== by 0x42C91D4: ???
    ==11044== by 0x41765DB: getservbyname_r (in /lib/tls/libc-2.3.6.so)
    ==11044== by 0x4144C42: (within /lib/tls/libc-2.3.6.so)
    ==11044==
    ==11044== LEAK SUMMARY:
    ==11044== definitely lost: 26,000 bytes in 1,000 blocks.
    ==11044== possibly lost: 0 bytes in 0 blocks.
    ==11044== still reachable: 0 bytes in 0 blocks.
    ==11044== suppressed: 0 bytes in 0 blocks.


  2. Re: is getaddrinfo memory leak?

    On 7月12日, 下午1时37分, step wrote:
    > hi all:
    > my program use getaddrinfo ,but when i use valgrind check memory
    > leak it show getaddrinfo memory leak
    > code:
    > int checkAddrType(const char *addr,const char *hostip)
    > {
    > struct sockaddr_in ad,*adp;
    > struct addrinfo hints,*result;
    > char buf[100];
    >
    > if(inet_pton(PF_INET,addr,&ad.sin_addr)<=0)
    > {
    > memset(&hints,0,sizeof(hints));
    > hints.ai_family=PF_UNSPEC;
    > hints.ai_socktype=SOCK_STREAM;
    > if(getaddrinfo(addr,"www",&hints,&result)!=0)
    > {
    > return -1;
    > }
    >
    > adp=(struct sockaddr_in *)result->ai_addr;
    > inet_ntop(PF_INET,&adp->sin_addr,buf,100);
    > freeaddrinfo(result);
    > if(compIp(buf,hostip)==0)
    > return 2;
    > return 3;
    >
    > }
    >
    > if(compIp(addr,hostip)==0)
    > return 1;
    >
    > return 0;}
    >
    > test code:
    >
    > #include
    >
    > int main(int argc,char **argv)
    > {
    >
    > int i;
    >
    > for(i=0;i<1000;i++)
    > {
    > checkAddrType("www.zju.edu.cn","10.10.8.22");
    > }
    >
    > return 0;
    >
    > }
    >
    > valgrind check log:
    > ==11044== Memcheck, a memory error detector.
    > ==11044== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et
    > al.
    > ==11044== Using LibVEX rev 1606, a library for dynamic binary
    > translation.
    > ==11044== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
    > ==11044== Using valgrind-3.2.0-Debian, a dynamic binary
    > instrumentation framework.
    > ==11044== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et
    > al.
    > ==11044== For more details, rerun with: -v
    > ==11044==
    > --11044-- DWARF2 CFI reader: unhandled CFI instruction 0:50
    > --11044-- DWARF2 CFI reader: unhandled CFI instruction 0:50
    > --11044-- DWARF2 CFI reader: unhandled CFI instruction 0:50
    > --11044-- DWARF2 CFI reader: unhandled CFI instruction 0:50
    > ==11044== Invalid read of size 4
    > ==11044== at 0x40114D0: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4004E29: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4006B55: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400A576: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400AB31: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4193BFB: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== Address 0x41C6E50 is 24 bytes inside a block of size 27
    > alloc'd
    > ==11044== at 0x401C4A1: malloc (vg_replace_malloc.c:149)
    > ==11044== by 0x4006DF0: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400A576: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400AB31: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4193BFB: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044==
    > ==11044== Invalid read of size 4
    > ==11044== at 0x40114B9: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4004E29: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4006B55: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400A576: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400AB31: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4193BFB: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== Address 0x41C717C is 20 bytes inside a block of size 22
    > alloc'd
    > ==11044== at 0x401C4A1: malloc (vg_replace_malloc.c:149)
    > ==11044== by 0x4006DF0: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400A576: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x400AB31: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4193BFB: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044==
    > ==11044== Conditional jump or move depends on uninitialised value(s)
    > ==11044== at 0x4009313: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4193EA9: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x417048E: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4171DCF: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x417669D: getservbyname_r (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4144C42: (within /lib/tls/libc-2.3.6.so)
    > ==11044==
    > ==11044== Conditional jump or move depends on uninitialised value(s)
    > ==11044== at 0x4008FB0: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4193EA9: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x417048E: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4171DCF: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x417669D: getservbyname_r (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4144C42: (within /lib/tls/libc-2.3.6.so)
    > ==11044==
    > ==11044== Invalid read of size 4
    > ==11044== at 0x40114D0: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4004E29: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4006B55: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4193B9F: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x4145E36: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4146855: getaddrinfo (in /lib/tls/libc-2.3.6.so)
    > ==11044== Address 0x41C8CC0 is 24 bytes inside a block of size 25
    > alloc'd
    > ==11044== at 0x401C4A1: malloc (vg_replace_malloc.c:149)
    > ==11044== by 0x4006DF0: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4193B9F: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x419455A: _dl_open (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4195AEC: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x400BA5E: (within /lib/ld-2.3.6.so)
    > ==11044== by 0x4195C4D: __libc_dlopen_mode (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x41702ED: __nss_lookup_function (in /lib/tls/
    > libc-2.3.6.so)
    > ==11044== by 0x4145E36: (within /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4146855: getaddrinfo (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x80486FE: checkAddrType (addressinfo.c:71)
    > ==11044==
    > ==11044== ERROR SUMMARY: 13 errors from 5 contexts (suppressed: 17
    > from 1)
    > ==11044== malloc/free: in use at exit: 26,000 bytes in 1,000 blocks.
    > ==11044== malloc/free: 17,067 allocs, 16,067 frees, 3,637,948 bytes
    > allocated.
    > ==11044== For counts of detected errors, rerun with: -v
    > ==11044== searching for pointers to 1,000 not-freed blocks.
    > ==11044== checked 92,612 bytes.
    > ==11044==
    > ==11044==
    > ==11044== 26,000 bytes in 1,000 blocks are definitely lost in loss
    > record 1 of 1
    > ==11044== at 0x401C4A1: malloc (vg_replace_malloc.c:149)
    > ==11044== by 0x439A5BF: ???
    > ==11044== by 0x439A656: ???
    > ==11044== by 0x4373483: ???
    > ==11044== by 0x436C8B4: ???
    > ==11044== by 0x436CE92: ???
    > ==11044== by 0x42C972D: ???
    > ==11044== by 0x42C9817: ???
    > ==11044== by 0x42C8F95: ???
    > ==11044== by 0x42C91D4: ???
    > ==11044== by 0x41765DB: getservbyname_r (in /lib/tls/libc-2.3.6.so)
    > ==11044== by 0x4144C42: (within /lib/tls/libc-2.3.6.so)
    > ==11044==
    > ==11044== LEAK SUMMARY:
    > ==11044== definitely lost: 26,000 bytes in 1,000 blocks.
    > ==11044== possibly lost: 0 bytes in 0 blocks.
    > ==11044== still reachable: 0 bytes in 0 blocks.
    > ==11044== suppressed: 0 bytes in 0 blocks.


    i change the "www" to NULL ,it ok , why???


  3. Re: is getaddrinfo memory leak?

    On Jul 11, 11:13 pm, step wrote:

    > i change the "www" to NULL ,it ok , why???


    It looks like a bug in your platform's library.

    DS


+ Reply to Thread