X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng-crash%2Flttng-crash.cpp;h=3987a60ddac334d2e75fabf213102c7d4d1ea0f6;hb=c29d17cd2d85f6ee89037377cc33821829529867;hp=bee9c29b0fd5bfc75cdf540df2b404835baa5893;hpb=21cf9b6b1843774306a76f4dccddddd706b64f79;p=lttng-tools.git diff --git a/src/bin/lttng-crash/lttng-crash.cpp b/src/bin/lttng-crash/lttng-crash.cpp index bee9c29b0..3987a60dd 100644 --- a/src/bin/lttng-crash/lttng-crash.cpp +++ b/src/bin/lttng-crash/lttng-crash.cpp @@ -20,15 +20,15 @@ #include #include #include -#include +#include #include #include -#include +#include #include -#include -#include -#include +#include +#include +#include #define COPY_BUFLEN 4096 #define RB_CRASH_DUMP_ABI_LEN 32 @@ -98,6 +98,7 @@ enum rb_modes { RING_BUFFER_DISCARD = 1, /* Discard when buffer full */ }; +namespace { struct crash_abi_unknown { uint8_t magic[RB_CRASH_DUMP_ABI_MAGIC_LEN]; uint64_t mmap_length; /* Overall length of crash record */ @@ -177,6 +178,7 @@ struct lttng_crash_layout { uint64_t num_subbuf; /* Number of sub-buffers for writer */ uint32_t mode; /* Buffer mode: 0: overwrite, 1: discard */ }; +} /* namespace */ /* Variables */ static const char *progname; @@ -781,7 +783,7 @@ int copy_crash_data(const struct lttng_crash_layout *layout, int fd_dest, return ret; } src_file_len = layout->mmap_length; - buf = (char *) zmalloc(src_file_len); + buf = calloc(src_file_len); if (!buf) { return -1; } @@ -1129,7 +1131,7 @@ int delete_dir_recursive(const char *path) } if (S_ISDIR(st.st_mode)) { - char *subpath = (char *) zmalloc(PATH_MAX); + char *subpath = calloc(PATH_MAX); if (!subpath) { PERROR("zmalloc path");