[PATCH] libio: use _IO_have_wbackup for wide streams
Florian Weimer
fweimer@redhat.com
Mon Jun 8 14:06:39 GMT 2026
* Andreas Schwab:
> Fix two wrong uses of _IO_have_backup on a wide stream.
> ---
> libio/wgenops.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libio/wgenops.c b/libio/wgenops.c
> index 5f36bc49a1..c2a8541b6d 100644
> --- a/libio/wgenops.c
> +++ b/libio/wgenops.c
> @@ -270,7 +270,7 @@ __wunderflow (FILE *fp)
> if (save_for_wbackup (fp, fp->_wide_data->_IO_read_end))
> return WEOF;
> }
> - else if (_IO_have_backup (fp))
> + else if (_IO_have_wbackup (fp))
> _IO_free_wbackup_area (fp);
> return _IO_UNDERFLOW (fp);
> }
> @@ -603,6 +603,6 @@ _IO_unsave_wmarkers (FILE *fp)
> fp->_markers = NULL;
> }
>
> - if (_IO_have_backup (fp))
> + if (_IO_have_wbackup (fp))
> _IO_free_wbackup_area (fp);
> }
I believe this okay. It's not a visible bug because even if we don't
free the allocation here, it gets freed in fclose. We don't support
dual-orientation streams, so _IO_have_wbackup should always be false.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
More information about the Libc-alpha
mailing list