X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=remote-curl.c;h=8ac5028343320b44b75c6945318fe5b328af81fd;hb=8894d5358095a08c2f700a87ce9fdefb0b6eb61b;hp=17d8a9b377265aeed9765f04d505959e1f7fb9b0;hpb=1dcfb2ac65cec5a706784d92523f0c53de0a8d95;p=git.git diff --git a/remote-curl.c b/remote-curl.c index 17d8a9b37..8ac502834 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -227,6 +227,8 @@ static struct ref *parse_info_refs(struct discovery *heads) if (data[i] == '\t') mid = &data[i]; if (data[i] == '\n') { + if (mid - start != 40) + die("%sinfo/refs not valid: is this a git repository?", url); data[i] = 0; ref_name = mid + 1; ref = xmalloc(sizeof(struct ref) + @@ -811,19 +813,21 @@ static void parse_push(struct strbuf *buf) strbuf_reset(buf); if (strbuf_getline(buf, stdin, '\n') == EOF) - return; + goto free_specs; if (!*buf->buf) break; } while (1); if (push(nr_spec, specs)) exit(128); /* error already reported */ - for (i = 0; i < nr_spec; i++) - free(specs[i]); - free(specs); printf("\n"); fflush(stdout); + + free_specs: + for (i = 0; i < nr_spec; i++) + free(specs[i]); + free(specs); } int main(int argc, const char **argv)