public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/27606] New: Memory leak in elf/cache.c (write_extensions)
@ 2021-03-18 18:08 carlos at redhat dot com
  0 siblings, 0 replies; only message in thread
From: carlos at redhat dot com @ 2021-03-18 18:08 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 27606
           Summary: Memory leak in elf/cache.c (write_extensions)
           Product: glibc
           Version: 2.33
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: carlos at redhat dot com
  Target Milestone: ---

492 static void
 493 write_extensions (int fd, uint32_t str_offset,
 494                   uint32_t cache_extension_offset)
 495 {
 496   assert ((cache_extension_offset % 4) == 0);
 497 
 498   /* The length and contents of the glibc-hwcaps section.  */
 499   uint32_t hwcaps_count = glibc_hwcaps_count ();
 500   uint32_t hwcaps_offset = cache_extension_offset + cache_extension_size;
 501   uint32_t hwcaps_size = hwcaps_count * sizeof (uint32_t);
 502   uint32_t *hwcaps_array = xmalloc (hwcaps_size);

We allocate hwcaps_array.

 545   if (write (fd, ext, ext_size) != ext_size
 546       || write (fd, hwcaps_array, hwcaps_size) != hwcaps_size
 547       || write (fd, generator, strlen (generator)) != strlen (generator))
 548     error (EXIT_FAILURE, errno, _("Writing of cache extension data
failed"));
 549 
 550   free (ext);
 551 }
 552 

Then we go out of scope without freeing hwcaps_array.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-18 18:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 18:08 [Bug dynamic-link/27606] New: Memory leak in elf/cache.c (write_extensions) 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).