[Bug stdio/33999] New: libio: potential dangling _IO_save_base or memory leak in wgenops.c

marocketbd at gmail dot com sourceware-bugzilla@sourceware.org
Tue Mar 17 10:55:06 GMT 2026


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

            Bug ID: 33999
           Summary: libio: potential dangling _IO_save_base or memory leak
                    in wgenops.c
           Product: glibc
           Version: 2.44
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: marocketbd at gmail dot com
  Target Milestone: ---

Similar to https://sourceware.org/bugzilla/show_bug.cgi?id=33998, in
wgenops.c::_IO_wdefault_finish, the function examine fp->_IO_save_base pointer,
but releasing fp->_wide_data->_IO_save_base. However, the rest deferences are
all based on fp->_wide_data, so this should be a mistake when copying code from
genops.c. If the file orientation is set to wide, then fp->_IO_save_base should
always be 0, so fp->_wide_data->_IO_save_base could lead to a potential memory
leak.

---

  if (fp->_IO_save_base)
    {
      free (fp->_wide_data->_IO_save_base);
      fp->_IO_save_base = NULL;
    }

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


More information about the Glibc-bugs mailing list