summaryrefslogtreecommitdiff
path: root/builtin/blame.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-07-21 12:35:39 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-07-21 12:35:39 -0700
commit9ab08822556c49a7856dadd0e9a42f9ec2aaf850 (patch)
treef52f20367d13f2078fe6199e230322c899b9308d /builtin/blame.c
parentNinth batch for 2.1 (diff)
parentuse xmemdupz() to allocate copies of strings given by start and length (diff)
downloadtgif-9ab08822556c49a7856dadd0e9a42f9ec2aaf850.tar.xz
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 c59e702021..32ce05f615 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 {