about summary refs log tree commit diff
path: root/sysdeps/i386/fpu/s_fmin.S
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2024-08-13 21:08:49 -0400
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2024-08-29 21:04:44 -0400
commita5cd39541396b91d90cc611858ee7b3355fcfe47 (patch)
tree6e4f11ec22de95718ceed61d00f005da8a30fa5e /sysdeps/i386/fpu/s_fmin.S
parent01a731da41a6d47cdd6b90f0da1d89dd8cf2b9cd (diff)
downloadglibc-a5cd39541396b91d90cc611858ee7b3355fcfe47.tar.gz
glibc-a5cd39541396b91d90cc611858ee7b3355fcfe47.tar.xz
glibc-a5cd39541396b91d90cc611858ee7b3355fcfe47.zip
ungetc: Fix backup buffer leak on program exit [BZ #27821]
If a file descriptor is left unclosed and is cleaned up by _IO_cleanup
on exit, its backup buffer remains unfreed, registering as a leak in
valgrind.  This is not strictly an issue since (1) the program should
ideally be closing the stream once it's not in use and (2) the program
is about to exit anyway, so keeping the backup buffer around a wee bit
longer isn't a real problem.  Free it anyway to keep valgrind happy
when the streams in question are the standard ones, i.e. stdout, stdin
or stderr.

Also, the _IO_have_backup macro checks for _IO_save_base,
which is a roundabout way to check for a backup buffer instead of
directly looking for _IO_backup_base.  The roundabout check breaks when
the main get area has not been used and user pushes a char into the
backup buffer with ungetc.  Fix this to use the _IO_backup_base
directly.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 3e1d8d1d1dca24ae90df2ea826a8916896fc7e77)
(cherry picked from commit b9f72bd5de931eac39219018c2fa319a449bb2cf)
Diffstat (limited to 'sysdeps/i386/fpu/s_fmin.S')
0 files changed, 0 insertions, 0 deletions