X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Flttng-elf.c;h=63e658177c67f9aee422830d055c9b7987544a1e;hb=a4159715f6854ad49989b6282da998c739b242e5;hp=91afcfdea3d19ae0435d655e4b49465064832d07;hpb=a1243fdc865a6d3320d8a74a9e92efa459e68ca4;p=lttng-tools.git diff --git a/src/common/lttng-elf.c b/src/common/lttng-elf.c index 91afcfdea..63e658177 100644 --- a/src/common/lttng-elf.c +++ b/src/common/lttng-elf.c @@ -646,13 +646,14 @@ char *lttng_elf_get_section_data(struct lttng_elf *elf, int ret; off_t section_offset; char *data; - const size_t max_alloc_size = min_t(size_t, MAX_SECTION_DATA_SIZE, - elf->file_size); + size_t max_alloc_size; if (!elf || !shdr) { goto error; } + max_alloc_size = min_t(size_t, MAX_SECTION_DATA_SIZE, elf->file_size); + section_offset = shdr->sh_offset; if (lseek(elf->fd, section_offset, SEEK_SET) < 0) { PERROR("Error seeking to section offset");