From: Michael Haggerty Date: Thu, 15 Sep 2011 21:10:38 +0000 (+0200) Subject: remote: avoid passing NULL to read_ref() X-Git-Tag: v1.7.8-rc0~19^2~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d51b720fca4ee5418952a90f785317592a7a1242;p=git.git remote: avoid passing NULL to read_ref() read_ref() can (and in test t5800, actually *does*) return NULL. Don't pass the NULL along to read_ref(). Coincidentally, this mistake didn't make resolve_ref() blow up, but upcoming changes to resolve_ref() will make it less forgiving. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- diff --git a/transport-helper.c b/transport-helper.c index 07131261f..6f227e253 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -446,8 +446,10 @@ static int fetch_with_import(struct transport *transport, private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name); else private = xstrdup(posn->name); - read_ref(private, posn->old_sha1); - free(private); + if (private) { + read_ref(private, posn->old_sha1); + free(private); + } } strbuf_release(&buf); return 0;