diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2011-09-15 23:10:38 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-05 13:45:31 -0700 |
commit | d51b720fca4ee5418952a90f785317592a7a1242 (patch) | |
tree | 0a42c14f8387f2f104e35b1bae87c8929829d06c /transport-helper.c | |
parent | c28cce55e0ea1d674ccc89cadadac0bfef511384 (diff) | |
download | git-d51b720fca4ee5418952a90f785317592a7a1242.tar.gz |
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 <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r-- | transport-helper.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/transport-helper.c b/transport-helper.c index 07131261fe..6f227e253b 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; |