summaryrefslogtreecommitdiff
path: root/builtin/blame.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-21 19:35:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-21 19:35:39 (GMT)
commit9ab08822556c49a7856dadd0e9a42f9ec2aaf850 (patch)
treef52f20367d13f2078fe6199e230322c899b9308d /builtin/blame.c
parent0eff86e4f440fedf26f02f4c3b1a3ead8bfbe6f8 (diff)
parent5c0b13f85ab3a5326508b854768eb70c8829cda4 (diff)
downloadgit-9ab08822556c49a7856dadd0e9a42f9ec2aaf850.zip
git-9ab08822556c49a7856dadd0e9a42f9ec2aaf850.tar.gz
git-9ab08822556c49a7856dadd0e9a42f9ec2aaf850.tar.bz2
Merge branch 'maint'
* maint: use xmemdupz() to allocate copies of strings given by start and length use xcalloc() to allocate zero-initialized memory
Diffstat (limited to 'builtin/blame.c')
-rw-r--r--builtin/blame.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index c59e702..32ce05f 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2707,11 +2707,8 @@ parse_done:
die("revision walk setup failed");
if (is_null_sha1(sb.final->object.sha1)) {
- char *buf;
o = sb.final->util;
- buf = xmalloc(o->file.size + 1);
- memcpy(buf, o->file.ptr, o->file.size + 1);
- sb.final_buf = buf;
+ sb.final_buf = xmemdupz(o->file.ptr, o->file.size);
sb.final_buf_size = o->file.size;
}
else {