X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Flttng-syscall.cpp;h=a3030bcf47e2d27aa3aea3a97de897ea66a1e594;hb=64803277bbdbe0a943360d918298a48157d9da55;hp=7dae12d9f39ea0c9b7ce1c2a83637ff5feabfdfd;hpb=3c3390532736cfb5198f863d0d2b218e21fcf76d;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/lttng-syscall.cpp b/src/bin/lttng-sessiond/lttng-syscall.cpp index 7dae12d9f..a3030bcf4 100644 --- a/src/bin/lttng-sessiond/lttng-syscall.cpp +++ b/src/bin/lttng-sessiond/lttng-syscall.cpp @@ -8,13 +8,13 @@ #define _LGPL_SOURCE #include -#include -#include +#include +#include -#include "lttng-sessiond.h" -#include "kernel.h" -#include "lttng-syscall.h" -#include "utils.h" +#include "lttng-sessiond.hpp" +#include "kernel.hpp" +#include "lttng-syscall.hpp" +#include "utils.hpp" /* Global syscall table. */ struct syscall *syscall_table; @@ -60,7 +60,7 @@ int syscall_init_table(int tracer_fd) } nbmem = SYSCALL_TABLE_INIT_SIZE; - syscall_table = (struct syscall *) zmalloc(sizeof(struct syscall) * nbmem); + syscall_table = calloc(nbmem); if (!syscall_table) { ret = -errno; PERROR("syscall list zmalloc"); @@ -156,6 +156,8 @@ static void destroy_syscall_ht(struct lttng_ht *ht) struct lttng_ht_iter iter; struct syscall *ksyscall; + ASSERT_RCU_READ_LOCKED(); + DBG3("Destroying syscall hash table."); if (!ht) { @@ -243,7 +245,7 @@ static int add_syscall_to_ht(struct lttng_ht *ht, unsigned int index, LTTNG_ASSERT(ht); - ksyscall = (struct syscall *) zmalloc(sizeof(*ksyscall)); + ksyscall = zmalloc(); if (!ksyscall) { ret = -LTTNG_ERR_NOMEM; goto error; @@ -286,7 +288,7 @@ ssize_t syscall_table_list(struct lttng_event **_events) * them might not be valid. The count below will make sure to return the * right size of the events array. */ - events = (lttng_event *) zmalloc(syscall_table_nb_entry * sizeof(*events)); + events = calloc(syscall_table_nb_entry); if (!events) { PERROR("syscall table list zmalloc"); ret = -LTTNG_ERR_NOMEM;