git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3 v2] Add support for external programs for handling native fetches

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Jul 28, 2009, 15:25 UTC
Message-ID
<alpine.LNX.2.00.0907281124060.2147@iabervon.org>
In-Reply-To
<36ca99e90907280107i7afb7c64tf0c49bdf82e1e7cb@mail.gmail.com>
On Tue, 28 Jul 2009, Bert Wesarg wrote:
Show 31 quoted lines
> On Tue, Jul 28, 2009 at 08:08, Daniel Barkalow<barkalow@iabervon.org> wrote:
> > +static struct child_process *get_shim(struct transport *transport)
> > +{
> > +       struct shim_data *data = transport->data;
> > +       if (!data->shim) {
> > +               struct strbuf buf = STRBUF_INIT;
> > +               struct child_process *shim = xcalloc(1, sizeof(*shim));
> > +               shim->in = -1;
> > +               shim->out = -1;
> > +               shim->err = 0;
> > +               shim->argv = xcalloc(4, sizeof(*shim->argv));
> > +               strbuf_addf(&buf, "shim-%s", data->name);
> > +               shim->argv[0] = buf.buf;
> > +               shim->argv[1] = transport->remote->name;
> > +               shim->argv[2] = transport->url;
> > +               shim->git_cmd = 1;
> > +               start_command(shim);
> > +               data->shim = shim;
> > +       }
> > +       return data->shim;
> > +}
> > +
> > +static int disconnect_shim(struct transport *transport)
> > +{
> > +       struct shim_data *data = transport->data;
> > +       if (data->shim) {
> > +               write(data->shim->in, "\n", 1);
> > +               close(data->shim->in);
> > +               finish_command(data->shim);
> > +               free(data->shim->argv);
> Does this leak data->shim->argv[0] (Ie "shim-%s")?

Yes, I guess it would. I think it's time to look up how to run tests with valgrind...

Thanks.
	-Daniel
*This .sig left intentionally blank*
Previous: Bert WesargNext: Johannes Schindelin
Message 3 of 6 in “Add support for external programs for handling native fetches”
  1. 1/3 Add support for external programs for handling native fetchesDaniel Barkalow, Jul 28, 2009
  2. Bert WesargJul 28, 2009
  3. Daniel BarkalowJul 28, 2009
  4. Johannes SchindelinJul 28, 2009
  5. Daniel BarkalowJul 28, 2009
  6. Johannes SchindelinJul 29, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.