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) +
}
#endif
-static size_t rpc_in(const void *ptr, size_t eltsize,
+static size_t rpc_in(char *ptr, size_t eltsize,
size_t nmemb, void *buffer_)
{
size_t size = eltsize * nmemb;
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)