Thread (6 messages) flat view 6 messages, 3 authors, 2016-06-15

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

From: Bert Wesarg <hidden>
Date: 2016-06-15 22:47:06

On Tue, Jul 28, 2009 at 08:08, Daniel Barkalow[off-list ref] 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")?

Bert
+               free(data->shim);
+               transport->data = NULL;
+       }
+       return 0;
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help