From e4f31af352065e16d08d4fb84b05fcc739adf13b Mon Sep 17 00:00:00 2001 From: Mactavish <maczhanchao@yahoo.com> Date: Mon, 24 Apr 2023 10:42:03 +0200 Subject: [PATCH] add cirtical situation --- clang.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clang.md b/clang.md index b4c39bb..2e9931e 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 -- GitLab