X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Frunas.cpp;h=6b1201deb6fc032c3dfb7cd4abcb7db6bd8e31fb;hb=64803277bbdbe0a943360d918298a48157d9da55;hp=ee3451321e7b8cbafb809fc4d3fe491cb6ee0a30;hpb=f46376a14da2eb796690cb4e718e8b213839d6ea;p=lttng-tools.git diff --git a/src/common/runas.cpp b/src/common/runas.cpp index ee3451321..6b1201deb 100644 --- a/src/common/runas.cpp +++ b/src/common/runas.cpp @@ -22,24 +22,24 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include +#include +#include -#include "runas.h" +#include "runas.hpp" #define GETPW_BUFFER_FALLBACK_SIZE 4096 @@ -629,16 +629,18 @@ end: } #else static -int _extract_elf_symbol_offset(struct run_as_data *data, - struct run_as_ret *ret_value) +int _extract_elf_symbol_offset( + struct run_as_data *data __attribute__((unused)), + struct run_as_ret *ret_value __attribute__((unused))) { ERR("Unimplemented runas command RUN_AS_EXTRACT_ELF_SYMBOL_OFFSET"); return -1; } static -int _extract_sdt_probe_offsets(struct run_as_data *data, - struct run_as_ret *ret_value) +int _extract_sdt_probe_offsets( + struct run_as_data *data __attribute__((unused)), + struct run_as_ret *ret_value __attribute__((unused))) { ERR("Unimplemented runas command RUN_AS_EXTRACT_SDT_PROBE_OFFSETS"); return -1; @@ -928,7 +930,7 @@ static int get_user_infos_from_uid( get_pw_buf_size = (size_t) raw_get_pw_buf_size; - buf = (char *) zmalloc(get_pw_buf_size); + buf = calloc(get_pw_buf_size); if (buf == NULL) { PERROR("Failed to allocate buffer to get password file entries"); goto error; @@ -1456,7 +1458,7 @@ int run_as_create_worker_no_lock(const char *procname, ret = 0; goto end; } - worker = (run_as_worker_data *) zmalloc(sizeof(*worker)); + worker = zmalloc(); if (!worker) { ret = -ENOMEM; goto end; @@ -1957,7 +1959,7 @@ int run_as_extract_sdt_probe_offsets(int fd, const char* provider_name, } *num_offset = run_as_ret.u.extract_sdt_probe_offsets.num_offset; - *offsets = (uint64_t *) zmalloc(*num_offset * sizeof(uint64_t)); + *offsets = calloc(*num_offset); if (!*offsets) { ret = -ENOMEM; goto error; @@ -1999,7 +2001,7 @@ int run_as_generate_filter_bytecode(const char *filter_expression, view_bytecode = (const struct lttng_bytecode *) run_as_ret.u.generate_filter_bytecode.bytecode; - local_bytecode = (lttng_bytecode *) zmalloc(sizeof(*local_bytecode) + view_bytecode->len); + local_bytecode = calloc(view_bytecode->len); if (!local_bytecode) { ret = -ENOMEM; goto error;