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>
Jim Meyering committed
Jun 12, 2007 at 22:59 UTC
aa32eedc69e4966cc822a2f9f07c30b437e40b8c
1 file changed
+1
-1
remote.c
+1
-1
@@ -542,7 +542,7 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
542
strcpy(dst_name, pat->dst);
543
strcat(dst_name, src->name + strlen(pat->src));
544
} else
545
- dst_name = strdup(src->name);
545
+ dst_name = xstrdup(src->name);
546
dst_peer = find_ref_by_name(dst, dst_name);
547
if (dst_peer && dst_peer->peer_ref)
548
/* We're already sending something to this ref. */