This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/23654] Memory leak in gconv_cache.c
- From: "fweimer at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 14 Sep 2018 07:25:02 +0000
- Subject: [Bug libc/23654] Memory leak in gconv_cache.c
- Auto-submitted: auto-generated
- References: <bug-23654-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=23654
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fweimer at redhat dot com
--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Hmm. valgrind says about this:
==2992== 208 bytes in 1 blocks are definitely lost in loss record 1 of 2
==2992== at 0x4C2CB6B: malloc (vg_replace_malloc.c:299)
==2992== by 0x4E62E9C: __gconv_lookup_cache (gconv_cache.c:371)
==2992== by 0x4E5BDC1: __gconv_find_transform (gconv_db.c:743)
==2992== by 0x4EE69E9: __wcsmbs_getfct (wcsmbsload.c:91)
==2992== by 0x4EE6D3B: __wcsmbs_named_conv (wcsmbsload.c:242)
==2992== by 0x4EB2B4E: _IO_file_fopen@@GLIBC_2.2.5 (fileops.c:361)
==2992== by 0x4EA6373: __fopen_internal (iofopen.c:86)
==2992== by 0x400708: main (fopen-ccs.c:19)
==2992==
==2992== 208 bytes in 1 blocks are definitely lost in loss record 2 of 2
==2992== at 0x4C2CB6B: malloc (vg_replace_malloc.c:299)
==2992== by 0x4E62D6D: __gconv_lookup_cache (gconv_cache.c:371)
==2992== by 0x4E5BDC1: __gconv_find_transform (gconv_db.c:743)
==2992== by 0x4EE69E9: __wcsmbs_getfct (wcsmbsload.c:91)
==2992== by 0x4EE6D5E: __wcsmbs_named_conv (wcsmbsload.c:246)
==2992== by 0x4EB2B4E: _IO_file_fopen@@GLIBC_2.2.5 (fileops.c:361)
==2992== by 0x4EA6373: __fopen_internal (iofopen.c:86)
==2992== by 0x400708: main (fopen-ccs.c:19)
This is with:
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
int
main (int argc, char **argv)
{
if (argc != 3)
errx (1, "usage: %s PATH CODESET", argv[0]);
const char *path = argv[1];
const char *codeset = argv[2];
FILE *fp;
{
char *mode;
if (asprintf (&mode, "r,ccs=%s", codeset) < 0)
err (1, "asprintf");
fp = fopen (path, mode);
if (fp == NULL)
err (1, "fopen");
free (mode);
}
wint_t ch = fgetwc (fp);
if (feof (fp))
puts ("file is empty");
else if (ferror (fp))
err (1, "fgetwc");
else
printf ("character: 0x%x\n", (int) ch);
fclose (fp);
return 0;
}
--
You are receiving this mail because:
You are on the CC list for the bug.