stdio: memory leak in multibyte printf

Bug #2002006 reported by Simon Chopin
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
Fix Released
In Progress
Simon Chopin

Bug Description

There's a memory leak when using printf for multibyte characters.

[Test case]

> test-printf.c cat <<EOF
#include <stdio.h>

int main()
    int i;
    for (i = 0; i < (1 << 16); ++i) printf("%.1371337ls", L"A\n");
    return 0;
gcc -o test-printf test-printf.c
/usr/bin/time -f '%M' ./test-printf > /dev/null

With the fix I get a 1544k footprint, without it 263232k.

[Regression potential]
The stdio subsystem is a fairly complex one and the patch isn't trivial, so we could introduce new bugs, especially in non-ASCII environments.

Simon Chopin (schopin)
Changed in glibc (Ubuntu):
status: New → Fix Released
Changed in glibc (Ubuntu Focal):
importance: Undecided → Medium
status: New → In Progress
assignee: nobody → Simon Chopin (schopin)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.