summaryrefslogtreecommitdiff
path: root/builtin-fetch--tool.c
diff options
context:
space:
mode:
authorPierre Habouzit <madcoder@debian.org>2007-09-16 00:32:36 +0200
committerJunio C Hamano <gitster@pobox.com>2007-09-18 17:42:17 -0700
commit182af8343c307436bb5364309aa6d4d46fa5911d (patch)
tree154c50047e12595027a0d61f54bfdd6ecd2305a5 /builtin-fetch--tool.c
parent39bd2eb56af89d43a08ba54699d9a1849ab57b39 (diff)
downloadgit-182af8343c307436bb5364309aa6d4d46fa5911d.tar.gz
Use xmemdupz() in many places.
Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-fetch--tool.c')
-rw-r--r--builtin-fetch--tool.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index 514a3cc018..349b59c258 100644
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
@@ -222,19 +222,15 @@ static char *find_local_name(const char *remote_name, const char *refs,
}
if (!strncmp(remote_name, ref, len) && ref[len] == ':') {
const char *local_part = ref + len + 1;
- char *ret;
int retlen;
if (!next)
retlen = strlen(local_part);
else
retlen = next - local_part;
- ret = xmalloc(retlen + 1);
- memcpy(ret, local_part, retlen);
- ret[retlen] = 0;
*force_p = single_force;
*not_for_merge_p = not_for_merge;
- return ret;
+ return xmemdupz(local_part, retlen);
}
ref = next;
}