diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:34:05 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:34:05 -0700 |
commit | 3b8e8af187cb86ed030432f1a067121fdd4b1c3b (patch) | |
tree | dd8cdaa18cfd70d6cfe6b0a3120fccb5f0a971cd /remote.c | |
parent | e91ae32a01ffe294b8510c1d8cd7138493a0712f (diff) | |
parent | cb6c38d5cce7d8d48a57346b332a68cea1489df1 (diff) | |
download | git-3b8e8af187cb86ed030432f1a067121fdd4b1c3b.tar.gz |
Merge branch 'jk/xstrfmt'
* jk/xstrfmt:
setup_git_env(): introduce git_path_from_env() helper
unique_path: fix unlikely heap overflow
walker_fetch: fix minor memory leak
merge: use argv_array when spawning merge strategy
sequencer: use argv_array_pushf
setup_git_env: use git_pathdup instead of xmalloc + sprintf
use xstrfmt to replace xmalloc + strcpy/strcat
use xstrfmt to replace xmalloc + sprintf
use xstrdup instead of xmalloc + strcpy
use xstrfmt in favor of manual size calculations
strbuf: add xstrfmt helper
Diffstat (limited to 'remote.c')
-rw-r--r-- | remote.c | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -170,7 +170,6 @@ static struct branch *make_branch(const char *name, int len) { struct branch *ret; int i; - char *refname; for (i = 0; i < branches_nr; i++) { if (len ? (!strncmp(name, branches[i]->name, len) && @@ -186,10 +185,7 @@ static struct branch *make_branch(const char *name, int len) ret->name = xstrndup(name, len); else ret->name = xstrdup(name); - refname = xmalloc(strlen(name) + strlen("refs/heads/") + 1); - strcpy(refname, "refs/heads/"); - strcpy(refname + strlen("refs/heads/"), ret->name); - ret->refname = refname; + ret->refname = xstrfmt("refs/heads/%s", ret->name); return ret; } |