diff --git a/clang.md b/clang.md index b4c39bb3fc38cb5c6d09442995f9bcf8f2157ec2..2e9931e74d057795225dc6b827e3ee8bdbaf6da5 100644 --- a/clang.md +++ b/clang.md @@ -452,6 +452,15 @@ int main() { > There is a problem for this program, can you find out? +#### Critical Situations + +- **Memory leak**: if you forget to deallocate memory - your program **will eventually run out of memory** +- **Double free**: if you call `free` twice on the same memory - possible **crash or exploitable vulnerability** +- **Use after free**: if you use data after calling `free` - possible **crash or exploitable vulnerability** + +In short, too many bad things can happen if you don't manage the memory correctly! + +Any solution? Yes, use [valgrind](https://valgrind.org/). ## C Compilation Process