X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=transport-helper.c;h=6f227e253bf638de37ce74347213657c23185afa;hb=dbdc07fcbe3a951df8a3869b42edb6fffd466486;hp=4eab844d4abfa29ce53b6245a5821ee7be03641b;hpb=411e6cf1971936ba31ffa142a6d5dc5c06dc8f7a;p=git.git diff --git a/transport-helper.c b/transport-helper.c index 4eab844d4..6f227e253 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -183,7 +183,7 @@ static struct child_process *get_helper(struct transport *transport) ALLOC_GROW(refspecs, refspec_nr + 1, refspec_alloc); - refspecs[refspec_nr++] = strdup(capname + strlen("refspec ")); + refspecs[refspec_nr++] = xstrdup(capname + strlen("refspec ")); } else if (!strcmp(capname, "connect")) { data->connect = 1; } else if (!prefixcmp(capname, "export-marks ")) { @@ -445,9 +445,11 @@ static int fetch_with_import(struct transport *transport, if (data->refspecs) private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name); else - private = strdup(posn->name); - read_ref(private, posn->old_sha1); - free(private); + private = xstrdup(posn->name); + if (private) { + read_ref(private, posn->old_sha1); + free(private); + } } strbuf_release(&buf); return 0;