From: Jim Meyering Date: Tue, 12 Jun 2007 20:59:21 +0000 (+0200) Subject: Don't dereference a strdup-returned NULL X-Git-Tag: v1.5.3-rc0~108 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=aa32eedc69e4966cc822a2f9f07c30b437e40b8c;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/remote.c b/remote.c index 33c8e5055..ed62a62fa 100644 --- a/remote.c +++ b/remote.c @@ -542,7 +542,7 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail, strcpy(dst_name, pat->dst); strcat(dst_name, src->name + strlen(pat->src)); } else - dst_name = strdup(src->name); + dst_name = xstrdup(src->name); dst_peer = find_ref_by_name(dst, dst_name); if (dst_peer && dst_peer->peer_ref) /* We're already sending something to this ref. */