Git development
 help / color / mirror / Atom feed
* [PATCH] Don't dereference a strdup-returned NULL
@ 2007-06-12 20:59 Jim Meyering
  0 siblings, 0 replies; only message in thread
From: Jim Meyering @ 2007-06-12 20:59 UTC (permalink / raw)
  To: git

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>
---
 remote.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/remote.c b/remote.c
index 33c8e50..ed62a62 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. */
--
1.5.2.1.159.g8d11

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-12 20:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-12 20:59 [PATCH] Don't dereference a strdup-returned NULL Jim Meyering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox