Don't dereference a strdup-returned NULL
There are only a dozen or so uses of strdup in all of git. Of those, most seem ok, but this one isn't: Signed-off-by: Jim Meyering <jim@meyering.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
c43f64a0af
commit
aa32eedc69
2
remote.c
2
remote.c
@ -542,7 +542,7 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
|
|||||||
strcpy(dst_name, pat->dst);
|
strcpy(dst_name, pat->dst);
|
||||||
strcat(dst_name, src->name + strlen(pat->src));
|
strcat(dst_name, src->name + strlen(pat->src));
|
||||||
} else
|
} else
|
||||||
dst_name = strdup(src->name);
|
dst_name = xstrdup(src->name);
|
||||||
dst_peer = find_ref_by_name(dst, dst_name);
|
dst_peer = find_ref_by_name(dst, dst_name);
|
||||||
if (dst_peer && dst_peer->peer_ref)
|
if (dst_peer && dst_peer->peer_ref)
|
||||||
/* We're already sending something to this ref. */
|
/* We're already sending something to this ref. */
|
||||||
|
Loading…
Reference in New Issue
Block a user