This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix memory leak in printf_positional
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, "Carlos O'Donell" <carlos at redhat dot com>, Joseph Myers <joseph at codesourcery dot com>, Paul Eggert <eggert at cs dot ucla dot edu>, GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Sat, 12 Sep 2015 12:22:27 -0700
- Subject: Re: [PATCH] Fix memory leak in printf_positional
- Authentication-results: sourceware.org; auth=none
- References: <1440571295-20230-1-git-send-email-eggert at cs dot ucla dot edu> <alpine dot DEB dot 2 dot 10 dot 1508281350520 dot 5939 at digraph dot polyomino dot org dot uk> <55E06924 dot 2000209 at redhat dot com> <CALoOobMkGafD9zvq9g13TM8_Nd+HmC58_8gMGTQhdefXpko3CA at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1508311039110 dot 27932 at digraph dot polyomino dot org dot uk> <CALoOobO2iV9hPNB_S7PDoL=cWVCPrSkKGaUQfqboxUg40fsrVw at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1509021004030 dot 3590 at digraph dot polyomino dot org dot uk> <CALoOobN6LcGFEkieN3CJQ7mKeL7m5H3_aaYb17uEW9ZE_zX4yA at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1509021427530 dot 27392 at digraph dot polyomino dot org dot uk> <55E73436 dot 1050305 at redhat dot com> <CALoOobMusa6usQCEAR2bs8ES2EbHRa9YuCARd9=ewq1eROPLmQ at mail dot gmail dot com> <mvmvbbsrmo4 dot fsf at hawking dot suse dot de> <CALoOobN0wsGZNMkg355rpoEiDjy66B=Up0WHf35BPgGcPMxuhA at mail dot gmail dot com> <mvm37yvsh34 dot fsf at hawking dot suse dot de> <CALoOobPeFxJUreNJD61+tvka3MfBcZF6zsEerWcKCJW5H8J63A at mail dot gmail dot com> <CALoOobMVAFNiGGd-QQBpBkH85iGRW6Nyb2JXvWuPvw=BGKJ8RA at mail dot gmail dot com> <CALoOobMnOE1oJRJug2-sSxKCv7edOY4keFBx02kAWizQv6=-Cw at mail dot gmail dot com> <55F47A20 dot 1040900 at gmail dot com>
On Sat, Sep 12, 2015 at 12:16 PM, Martin Sebor <msebor@gmail.com> wrote:
> I see the test disables optimization to work around the GCC issue
> but I wonder if a better solution might be to create an array object
> for the format string rather than passing it as a literal to printf.
You mean like this:
char fmt[] = "%$1s %$2s ...";
printf(fmt, "a", "a", ...);
If so, no: the format literal is not what triggers the the GCC problem
-- the number of arguments being passed to printf does.
--
Paul Pluzhnikov