summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2006-09-02 00:16:31 -0400
committerJunio C Hamano <junkio@cox.net>2006-09-02 03:24:37 -0700
commit9befac470b4cfad529032dbcffcb71242ec71f91 (patch)
treef3715172da747456dd63c6d80c3f1e0a7d6f2d56 /connect.c
parentad1ed5ee896ba5d7f89bc04c7441b1532efb9853 (diff)
downloadgit-9befac470b4cfad529032dbcffcb71242ec71f91.tar.gz
Replace uses of strdup with xstrdup.
Like xmalloc and xrealloc xstrdup dies with a useful message if the native strdup() implementation returns NULL rather than a valid pointer. I just tried to use xstrdup in new code and found it to be missing. However I expected it to be present as xmalloc and xrealloc are already commonly used throughout the code. [jc: removed the part that deals with last_XXX, which I am finding more and more dubious these days.] Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/connect.c b/connect.c
index e501ccce25..06ef387649 100644
--- a/connect.c
+++ b/connect.c
@@ -69,7 +69,7 @@ struct ref **get_remote_heads(int in, struct ref **list,
if (len != name_len + 41) {
if (server_capabilities)
free(server_capabilities);
- server_capabilities = strdup(name + name_len + 1);
+ server_capabilities = xstrdup(name + name_len + 1);
}
if (!check_ref(name, name_len, flags))
@@ -661,7 +661,7 @@ int git_connect(int fd[2], char *url, const char *prog)
if (path[1] == '~')
path++;
else {
- path = strdup(ptr);
+ path = xstrdup(ptr);
free_path = 1;
}
@@ -672,7 +672,7 @@ int git_connect(int fd[2], char *url, const char *prog)
/* These underlying connection commands die() if they
* cannot connect.
*/
- char *target_host = strdup(host);
+ char *target_host = xstrdup(host);
if (git_use_proxy(host))
git_proxy_connect(fd, host);
else