struct object *o;
char namebuf[GIT_MAX_HEXSZ + 2]; /* ^ + hash + LF */
const unsigned hexsz = the_hash_algo->hexsz;
+ int ret;
if (do_reachable_revlist(&cmd, &data->shallows, reachable,
- data->allow_uor) < 0)
- return -1;
+ data->allow_uor) < 0) {
+ ret = -1;
+ goto out;
+ }
while ((i = read_in_full(cmd.out, namebuf, hexsz + 1)) == hexsz + 1) {
struct object_id oid;
}
close(cmd.out);
- if (finish_command(&cmd))
- return -1;
+ if (finish_command(&cmd)) {
+ ret = -1;
+ goto out;
+ }
- return 0;
+ ret = 0;
+
+out:
+ child_process_clear(&cmd);
+ return ret;
}
static int has_unreachable(struct object_array *src, enum allow_uor allow_uor)
int i;
if (do_reachable_revlist(&cmd, src, NULL, allow_uor) < 0)
- return 1;
+ goto error;
/*
* The commits out of the rev-list are not ancestors of
error:
if (cmd.out >= 0)
close(cmd.out);
+ child_process_clear(&cmd);
return 1;
}