Hi Peff,

On Wed, 26 Apr 2017, Jeff King wrote:

> On Tue, Apr 25, 2017 at 03:51:49PM +0200, Johannes Schindelin wrote:
> 
> > --- a/sequencer.c
> > +++ b/sequencer.c
> > [...]
> > +int sequencer_make_script(int keep_empty, FILE *out,
> > +           int argc, const char **argv)
> > +{
> > +   char *format = "%s";
> 
> I'm surprised the compiler doesn't complain about assigning a string
> literal to a non-const pointer. It makes me worried that we would call
> free() on it later. We don't, but that means...
> 
> > +   git_config_get_string("rebase.instructionFormat", &format);
> 
> ...that this assignment to "format" leaks.
> 
> So perhaps you'd want to xstrdup the literal, and then make sure the
> result is freed? Or alternatively use an extra level of indirection (a
> to_free pointer to store the config value, and then a const pointer for
> "format").

Good suggestion. Will be part of v3,
Dscho

Reply via email to