Skip to content

Commit aa32eed

Browse files
meyeringgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c43f64a commit aa32eed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
542542
strcpy(dst_name, pat->dst);
543543
strcat(dst_name, src->name + strlen(pat->src));
544544
} else
545-
dst_name = strdup(src->name);
545+
dst_name = xstrdup(src->name);
546546
dst_peer = find_ref_by_name(dst, dst_name);
547547
if (dst_peer && dst_peer->peer_ref)
548548
/* We're already sending something to this ref. */

0 commit comments

Comments
 (0)