]> sourceware.org Git - valgrind.git/commit
Bug 436413 - Warn about realloc of size zero
authorPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 10 Mar 2023 20:55:14 +0000 (21:55 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 10 Mar 2023 20:55:14 +0000 (21:55 +0100)
commit50bded71b23cb11a8b6c1b6eaf6e3abcc05a06c2
tree998a91cb2a38b433a00190c451b6f59697bc7c3f
parent4af62304d95701ed110f4ba89c5a9ceeb0255393
Bug 436413 - Warn about realloc of size zero

Adds a new warning to memcheck when realloc is used with a size of 0.
For a long time this has been "implementation defined" and so
non-portable. With C23 it will become UB.

Also adds a switch to turn off the error generation and a
second switch to select between the most common
"implementation" behaviours. The defaults for this second
switch are baked in at build time.
51 files changed:
.gitignore
NEWS
coregrind/m_main.c
coregrind/m_replacemalloc/replacemalloc_core.c
coregrind/m_replacemalloc/vg_replace_malloc.c
coregrind/m_scheduler/scheduler.c
coregrind/pub_core_replacemalloc.h
dhat/dh_main.c
docs/xml/manual-core.xml
drd/drd_malloc_wrappers.c
drd/tests/memory_allocation.c
helgrind/hg_main.c
include/pub_tool_replacemalloc.h
massif/ms_main.c
massif/tests/realloc.post.exp
massif/tests/realloc.vgtest
memcheck/docs/mc-manual.xml
memcheck/mc_errors.c
memcheck/mc_include.h
memcheck/mc_main.c
memcheck/mc_malloc_wrappers.c
memcheck/tests/Makefile.am
memcheck/tests/amd64-freebsd/reallocf.c
memcheck/tests/amd64-freebsd/reallocf.stderr.exp
memcheck/tests/freebsd/static_allocs.stderr.exp
memcheck/tests/realloc_size_zero.c [new file with mode: 0644]
memcheck/tests/realloc_size_zero.stderr.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero.stdout.exp-glibc [new file with mode: 0644]
memcheck/tests/realloc_size_zero.stdout.exp-other [new file with mode: 0644]
memcheck/tests/realloc_size_zero.supp [new file with mode: 0644]
memcheck/tests/realloc_size_zero.vgtest [new file with mode: 0644]
memcheck/tests/realloc_size_zero_mismatch.cpp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_mismatch.stderr.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_mismatch.stdout.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_mismatch.vgtest [new file with mode: 0644]
memcheck/tests/realloc_size_zero_no.stderr.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_no.stdout.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_no.vgtest [new file with mode: 0644]
memcheck/tests/realloc_size_zero_off.stderr.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_off.stdout.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_off.vgtest [new file with mode: 0644]
memcheck/tests/realloc_size_zero_supp.stderr.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_supp.stdout.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_supp.vgtest [new file with mode: 0644]
memcheck/tests/realloc_size_zero_yes.stderr.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_yes.stdout.exp [new file with mode: 0644]
memcheck/tests/realloc_size_zero_yes.vgtest [new file with mode: 0644]
none/tests/cmdline1.stdout.exp
none/tests/cmdline1.stdout.exp-non-linux
none/tests/cmdline2.stdout.exp
none/tests/cmdline2.stdout.exp-non-linux
This page took 0.040474 seconds and 5 git commands to generate.