提交 d51b720f 编写于 作者: M Michael Haggerty 提交者: Junio C Hamano

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: NMichael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 c28cce55
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册