[PATCH] Fix memory leak in printf_positional

Paul Pluzhnikov ppluzhnikov@google.com
Sat Sep 12 19:23:00 GMT 2015


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



More information about the Libc-alpha mailing list