public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/28852] New: getaddrinfo leaks memory with AI_ALL
@ 2022-02-02 15:45 siddhesh at sourceware dot org
  2022-03-22 14:13 ` [Bug libc/28852] " cvs-commit at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: siddhesh at sourceware dot org @ 2022-02-02 15:45 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28852

            Bug ID: 28852
           Summary: getaddrinfo leaks memory with AI_ALL
           Product: glibc
           Version: 2.35
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: siddhesh at sourceware dot org
          Reporter: siddhesh at sourceware dot org
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Steps to Reproduce:

$ cat gai_leak.c
#include <sys/types.h>
#include <sys/socket.h>

#include <netdb.h>
#include <stdio.h>
#include <unistd.h>

int main(void) {
    struct addrinfo hints = {0};
    struct addrinfo *addr;
    int error;

    hints.ai_family = AF_INET6;
    hints.ai_flags =  AI_V4MAPPED | AI_ALL;

    error = getaddrinfo("google.com", "80", &hints, &addr);
    if (error)
        fprintf(stderr, "getaddrinfo: %s", gai_strerror(error));
    freeaddrinfo(addr);


    return 0;
}


$ gcc -o gai_leak gai_leak.c
$ valgrind --leak-check=full ./gai_leak

Actual results:

$ valgrind --leak-check=full ./gai_leak
...
==4882== LEAK SUMMARY:
==4882==    definitely lost: 40 bytes in 1 blocks
==4882==    indirectly lost: 0 bytes in 0 blocks
==4882==      possibly lost: 0 bytes in 0 blocks
==4882==    still reachable: 6,801 bytes in 16 blocks
==4882==         suppressed: 0 bytes in 0 blocks
==4882== Reachable blocks (those to which a pointer was found) are not shown.
==4882== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==4882== 
==4882== For lists of detected and suppressed errors, rerun with: -s
==4882== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/28852] getaddrinfo leaks memory with AI_ALL
  2022-02-02 15:45 [Bug libc/28852] New: getaddrinfo leaks memory with AI_ALL siddhesh at sourceware dot org
@ 2022-03-22 14:13 ` cvs-commit at gcc dot gnu.org
  2022-03-22 14:15 ` siddhesh at sourceware dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-22 14:13 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28852

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Siddhesh Poyarekar
<siddhesh@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=300460460706ce3ffe29a7df8966e68323ec5bf1

commit 300460460706ce3ffe29a7df8966e68323ec5bf1
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Thu Mar 3 23:07:42 2022 +0530

    getaddrinfo: Fix leak with AI_ALL [BZ #28852]

    Use realloc in convert_hostent_to_gaih_addrtuple and fix up pointers in
    the result list so that a single block is maintained for
    hostbyname3_r/hostbyname2_r and freed in gaih_inet.  This result is
    never merged with any other results, since the hosts database does not
    permit merging.

    Resolves BZ #28852.

    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    Reviewed-by: DJ Delorie <dj@redhat.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/28852] getaddrinfo leaks memory with AI_ALL
  2022-02-02 15:45 [Bug libc/28852] New: getaddrinfo leaks memory with AI_ALL siddhesh at sourceware dot org
  2022-03-22 14:13 ` [Bug libc/28852] " cvs-commit at gcc dot gnu.org
@ 2022-03-22 14:15 ` siddhesh at sourceware dot org
  2023-09-15 23:47 ` cvs-commit at gcc dot gnu.org
  2023-09-16  0:49 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: siddhesh at sourceware dot org @ 2022-03-22 14:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28852

Siddhesh Poyarekar <siddhesh at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |2.36

--- Comment #2 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/28852] getaddrinfo leaks memory with AI_ALL
  2022-02-02 15:45 [Bug libc/28852] New: getaddrinfo leaks memory with AI_ALL siddhesh at sourceware dot org
  2022-03-22 14:13 ` [Bug libc/28852] " cvs-commit at gcc dot gnu.org
  2022-03-22 14:15 ` siddhesh at sourceware dot org
@ 2023-09-15 23:47 ` cvs-commit at gcc dot gnu.org
  2023-09-16  0:49 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-15 23:47 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28852

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.35/master branch has been updated by Siddhesh Poyarekar
<siddhesh@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d02808dee9f7e7fa950d83c12ecdbc13053e85e5

commit d02808dee9f7e7fa950d83c12ecdbc13053e85e5
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Thu Mar 3 23:07:42 2022 +0530

    getaddrinfo: Fix leak with AI_ALL [BZ #28852]

    Use realloc in convert_hostent_to_gaih_addrtuple and fix up pointers in
    the result list so that a single block is maintained for
    hostbyname3_r/hostbyname2_r and freed in gaih_inet.  This result is
    never merged with any other results, since the hosts database does not
    permit merging.

    Resolves BZ #28852.

    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    Reviewed-by: DJ Delorie <dj@redhat.com>
    (cherry picked from commit 300460460706ce3ffe29a7df8966e68323ec5bf1)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/28852] getaddrinfo leaks memory with AI_ALL
  2022-02-02 15:45 [Bug libc/28852] New: getaddrinfo leaks memory with AI_ALL siddhesh at sourceware dot org
                   ` (2 preceding siblings ...)
  2023-09-15 23:47 ` cvs-commit at gcc dot gnu.org
@ 2023-09-16  0:49 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-16  0:49 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28852

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.34/master branch has been updated by Siddhesh Poyarekar
<siddhesh@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f7efb43738f255db32cfa4e84a491c09f6da66e2

commit f7efb43738f255db32cfa4e84a491c09f6da66e2
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Thu Mar 3 23:07:42 2022 +0530

    getaddrinfo: Fix leak with AI_ALL [BZ #28852]

    Use realloc in convert_hostent_to_gaih_addrtuple and fix up pointers in
    the result list so that a single block is maintained for
    hostbyname3_r/hostbyname2_r and freed in gaih_inet.  This result is
    never merged with any other results, since the hosts database does not
    permit merging.

    Resolves BZ #28852.

    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    Reviewed-by: DJ Delorie <dj@redhat.com>
    (cherry picked from commit 300460460706ce3ffe29a7df8966e68323ec5bf1)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-16  0:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 15:45 [Bug libc/28852] New: getaddrinfo leaks memory with AI_ALL siddhesh at sourceware dot org
2022-03-22 14:13 ` [Bug libc/28852] " cvs-commit at gcc dot gnu.org
2022-03-22 14:15 ` siddhesh at sourceware dot org
2023-09-15 23:47 ` cvs-commit at gcc dot gnu.org
2023-09-16  0:49 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).