X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=connect.c;h=3aefd4ace590082b85bd3c4b9b41b8d1f1c72268;hb=b2979ff599a6bcf9dbf5e2ef1e32b81a1b88e115;hp=44e423dafd5c5e6566124fd1bb05f3d419b19a40;hpb=35865ca24500a0d46a012f7a55f39bf36389f7ba;p=git.git diff --git a/connect.c b/connect.c index 44e423daf..3aefd4ace 100644 --- a/connect.c +++ b/connect.c @@ -36,6 +36,11 @@ static int check_ref(const char *name, int len, unsigned int flags) return !(flags & ~REF_NORMAL); } +int check_ref_type(const struct ref *ref, int flags) +{ + return check_ref(ref->name, strlen(ref->name), flags); +} + /* * Read all the refs from the other end */ @@ -476,9 +481,10 @@ char *get_port(char *host) * * If it returns, the connect is successful; it just dies on errors. */ -struct child_process *git_connect(int fd[2], char *url, +struct child_process *git_connect(int fd[2], const char *url_orig, const char *prog, int flags) { + char *url = xstrdup(url_orig); char *host, *path = url; char *end; int c; @@ -568,6 +574,7 @@ struct child_process *git_connect(int fd[2], char *url, prog, path, 0, target_host, 0); free(target_host); + free(url); if (free_path) free(path); return NULL; @@ -619,6 +626,7 @@ struct child_process *git_connect(int fd[2], char *url, fd[0] = conn->out; /* read from child's stdout */ fd[1] = conn->in; /* write to child's stdin */ strbuf_release(&cmd); + free(url); if (free_path) free(path); return conn;