public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/29895] New: libio/tst-fopenloc leaks when GCONV_PATH not set
@ 2022-12-12 22:07 dj at redhat dot com
  2022-12-15 14:48 ` [Bug libc/29895] " carlos at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: dj at redhat dot com @ 2022-12-12 22:07 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 29895
           Summary: libio/tst-fopenloc leaks when GCONV_PATH not set
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: dj at redhat dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

While working on a project to run out in-tree testsuite against an installed
system-level set of files, I encountered one test that failed.  I narrowed it
down to a malloc() which is never free()'d in iconv/gconv_cache.c:

#0  __gconv_lookup_cache (toset=toset@entry=0x7ffff7f74a89 "INTERNAL", 
    fromset=fromset@entry=0x7ffff8031e30 "ISO-8859-1//",
handle=handle@entry=0x7fffffffd8a0, 
    nsteps=nsteps@entry=0x7fffffffd898, flags=flags@entry=0) at
gconv_cache.c:243
#1  0x00007ffff7e0563f in __gconv_find_transform
(toset=toset@entry=0x7ffff7f74a89 "INTERNAL", 
    fromset=fromset@entry=0x7ffff8031e30 "ISO-8859-1//",
handle=handle@entry=0x7fffffffd8a0, 
    nsteps=nsteps@entry=0x7fffffffd898, flags=flags@entry=0) at gconv_db.c:717
#2  0x00007ffff7e9ea38 in __wcsmbs_getfct (nstepsp=0x7fffffffd8e8,
from=0x7ffff8031e30 "ISO-8859-1//", 
    to=0x7ffff7f74a89 "INTERNAL") at wcsmbsload.c:91
#3  __wcsmbs_named_conv (copy=copy@entry=0x7fffffffd8e0,
name=name@entry=0x7ffff8031e30 "ISO-8859-1//")
    at wcsmbsload.c:251
#4  0x00007ffff7e618c0 in _IO_new_file_fopen (fp=fp@entry=0x7ffff7fff300, 
    filename=filename@entry=0x7ffff7fc1040 "../iconvdata/testdata/ISO-8859-1",
mode=<optimized out>, 
    mode@entry=0x7ffff7fc1010 "r,ccs=ISO-8859-1", is32not64=is32not64@entry=1)
at fileops.c:307
#5  0x00007ffff7e549ad in __fopen_internal (filename=0x7ffff7fc1040
"../iconvdata/testdata/ISO-8859-1", 
    mode=0x7ffff7fc1010 "r,ccs=ISO-8859-1", is32=1) at iofopen.c:75

It seems to be this call to malloc:

  /* We will use up to two modules.  Always allocate room for two.  */
  result = (struct __gconv_step *) malloc (2 * sizeof (struct __gconv_step));
  if (result == NULL)
    return __GCONV_NOMEM;

To reproduce, start with these two:

make test t=libio/tst-fopenloc
make test t=libio/tst-fopenloc-mem

Then, rerun the commands those run, but omit the GCONV_PATH= part.  The -mem
test should indicate two leaks:

Memory not freed:
-----------------
           Address     Size     Caller
0x0000555555f10560     0xd0  at 0x320ea
0x0000555555f11590     0xd0  at 0x321bc

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

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

* [Bug libc/29895] libio/tst-fopenloc leaks when GCONV_PATH not set
  2022-12-12 22:07 [Bug libc/29895] New: libio/tst-fopenloc leaks when GCONV_PATH not set dj at redhat dot com
@ 2022-12-15 14:48 ` carlos at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: carlos at redhat dot com @ 2022-12-15 14:48 UTC (permalink / raw)
  To: glibc-bugs

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

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
                 CC|                            |carlos at redhat dot com
             Status|NEW                         |RESOLVED

--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
This bug was detected a long time ago by the LeakSanitizer team and Florian
also independently found this in 2019.

Marking this closed as a duplicate of 24583.

*** This bug has been marked as a duplicate of bug 24583 ***

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

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

end of thread, other threads:[~2022-12-15 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 22:07 [Bug libc/29895] New: libio/tst-fopenloc leaks when GCONV_PATH not set dj at redhat dot com
2022-12-15 14:48 ` [Bug libc/29895] " carlos at redhat dot com

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).