|
From: Philippe W. <phi...@so...> - 2018-08-10 04:38:53
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=0e11eeacc93cf3968abd74578f1bedb52de110bd commit 0e11eeacc93cf3968abd74578f1bedb52de110bd Author: Philippe Waroquiers <phi...@sk...> Date: Fri Aug 10 06:35:02 2018 +0200 Fix warning that VG_(free(basename)) might discard const qualifier So, unconditionally allocate some memory in a non const variable. Diff: --- coregrind/m_coredump/coredump-elf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coregrind/m_coredump/coredump-elf.c b/coregrind/m_coredump/coredump-elf.c index b851968..2d36b26 100644 --- a/coregrind/m_coredump/coredump-elf.c +++ b/coregrind/m_coredump/coredump-elf.c @@ -574,7 +574,7 @@ static void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, ULong max_size) { HChar* buf = NULL; - const HChar *basename = "vgcore"; + HChar *basename; const HChar *coreext = ""; Int seq = 0; Int core_fd; @@ -594,7 +594,8 @@ void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, ULong max_size) coreext = ".core"; basename = VG_(expand_file_name)("--log-file", VG_(clo_log_fname_unexpanded)); - } + } else + basename = VG_(strdup)("coredump-elf.mec.1", "vgcore"); vg_assert(coreext); vg_assert(basename); @@ -722,7 +723,7 @@ void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, ULong max_size) continue; if (phdrs[idx].p_filesz > 0) { - vg_assert(VG_(lseek)(core_fd, phdrs[idx].p_offset, VKI_SEEK_SET) + vg_assert(VG_(lseek)(core_fd, phdrs[idx].p_offset, VKI_SEEK_SET) == phdrs[idx].p_offset); vg_assert(seg->end - seg->start + 1 >= phdrs[idx].p_filesz); @@ -734,8 +735,7 @@ void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, ULong max_size) VG_(close)(core_fd); cleanup: - if (VG_(clo_log_fname_unexpanded) != NULL) - VG_(free)(basename); + VG_(free)(basename); VG_(free)(buf); VG_(free)(seg_starts); VG_(free)(phdrs); |