One of the C dynamic memory allocation functions is realloc. Given a pointer, realloc will resize the memory block it points to. This sounds like a simple and useful mechanism to do memory management. But realloc has various gotchas that Valgrind Memcheck can check for to ensure you use the function correctly. Memory blocks should exist and have not yet been freed, blocks can be moved when resized
![Checking usage of realloc with Valgrind | Red Hat Developer](https://cdn-ak-scissors.b.st-hatena.com/image/square/c14960abc922ecb3ea2567328685014c32b7b6e6/height=288;version=1;width=512/https%3A%2F%2Fdevelopers.redhat.com%2Fsites%2Fdefault%2Ffiles%2Fstyles%2Fshare%2Fpublic%2FValgrind_tool_TopicImage-01.png%3Fitok%3D3fkuVoKT)