aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/receive-pack.c4
-rw-r--r--git-compat-util.h2
2 files changed, 2 insertions, 4 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index a744437b5..05d04400f 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1375,11 +1375,9 @@ static struct command **queue_command(struct command **tail,
refname = line + 82;
reflen = linelen - 82;
- cmd = xcalloc(1, st_add3(sizeof(struct command), reflen, 1));
+ FLEX_ALLOC_MEM(cmd, ref_name, refname, reflen);
hashcpy(cmd->old_sha1, old_sha1);
hashcpy(cmd->new_sha1, new_sha1);
- memcpy(cmd->ref_name, refname, reflen);
- cmd->ref_name[reflen] = '\0';
*tail = cmd;
return &cmd->next;
}
diff --git a/git-compat-util.h b/git-compat-util.h
index 9eab47126..b4b7f4495 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -802,7 +802,7 @@ extern FILE *fopen_for_writing(const char *path);
* you can do:
*
* struct foo *f;
- * FLEX_ALLOC_STR(f, name, src);
+ * FLEXPTR_ALLOC_STR(f, name, src);
*
* and "name" will point to a block of memory after the struct, which will be
* freed along with the struct (but the pointer can be repointed anywhere).