summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Syromyatnikov <evgsyr@gmail.com>2019-02-22 18:41:31 +0100
committerDmitry V. Levin <ldv@altlinux.org>2019-05-21 23:30:35 +0000
commit95259713fc31d58969928542008185239eeae192 (patch)
treeb9beb07b230d90ddec911f8806e61228353b6f21
parente0c1fc1cb8295f463659bb71985d98141a34549b (diff)
downloadstrace-95259713fc31d58969928542008185239eeae192.tar.gz
Use xzalloc(sz) instead of xcalloc(1, sz)
* aux_children.c (register_aux_child_ex): Use xzalloc instead of xcalloc of one-item-sized array. * bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Likewise. * kvm.c (vcpu_alloc): Likewise. * perf.c (fetch_perf_event_attr): Likewise. * syscall.c (ptrace_get_scno): Likewise.
-rw-r--r--aux_children.c2
-rw-r--r--bpf.c2
-rw-r--r--kvm.c2
-rw-r--r--perf.c2
-rw-r--r--syscall.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/aux_children.c b/aux_children.c
index f3b25c344..1f7267b12 100644
--- a/aux_children.c
+++ b/aux_children.c
@@ -65,7 +65,7 @@ register_aux_child_ex(pid_t pid, const struct aux_child_handlers *h,
error_func_msg_and_die("Duplicate auxiliary child pid");
}
- child = xcalloc(1, sizeof(*child));
+ child = xzalloc(sizeof(*child));
child->pid = pid;
child->handlers = h ?: &default_handlers;
diff --git a/bpf.c b/bpf.c
index 1eeb0e440..420b44026 100644
--- a/bpf.c
+++ b/bpf.c
@@ -780,7 +780,7 @@ BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)
struct obj_get_info_saved *saved;
if (entering(tcp)) {
- saved = xcalloc(1, sizeof(*saved));
+ saved = xzalloc(sizeof(*saved));
saved->info_len = attr.info_len;
set_tcb_priv_data(tcp, saved, free);
diff --git a/kvm.c b/kvm.c
index 5271322f9..984a75e86 100644
--- a/kvm.c
+++ b/kvm.c
@@ -44,7 +44,7 @@ vcpu_find(struct tcb *const tcp, int fd)
static struct vcpu_info *
vcpu_alloc(struct tcb *const tcp, int fd, int cpuid)
{
- struct vcpu_info *vcpu_info = xcalloc(1, sizeof(*vcpu_info));
+ struct vcpu_info *vcpu_info = xzalloc(sizeof(*vcpu_info));
vcpu_info->fd = fd;
vcpu_info->cpuid = cpuid;
diff --git a/perf.c b/perf.c
index d3a981660..f989dfcc8 100644
--- a/perf.c
+++ b/perf.c
@@ -74,7 +74,7 @@ fetch_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
/* Size should be multiple of 8, but kernel doesn't check for it */
/* size &= ~7; */
- attr = xcalloc(1, sizeof(*attr));
+ attr = xzalloc(sizeof(*attr));
if (umoven_or_printaddr(tcp, addr, size, attr)) {
free(attr);
diff --git a/syscall.c b/syscall.c
index 156243c91..308fc40a8 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1305,7 +1305,7 @@ get_scno(struct tcb *tcp)
tcp->s_ent = &sysent[tcp->scno];
tcp->qual_flg = qual_flags(tcp->scno);
} else {
- struct sysent_buf *s = xcalloc(1, sizeof(*s));
+ struct sysent_buf *s = xzalloc(sizeof(*s));
s->tcp = tcp;
s->ent = stub_sysent;