mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
memory leak example
This commit is contained in:
14
README.adoc
14
README.adoc
@@ -12857,7 +12857,9 @@ Allocate memory! Vs using the stack: https://stackoverflow.com/questions/4584089
|
||||
|
||||
link:userland/c/malloc.c[]: `malloc` hello world: allocate two ints and use them.
|
||||
|
||||
LInux 5.1 / glibc 2.29 implements it with the <<mmap,`mmap` system call>>.
|
||||
Linux 5.1 / glibc 2.29 implements it with the <<mmap,`mmap` system call>>.
|
||||
|
||||
`malloc` leads to the infinite joys of <<memory-leaks>>.
|
||||
|
||||
===== malloc implementation
|
||||
|
||||
@@ -13125,7 +13127,15 @@ Let's group the hard-to-debug undefined-behaviour-like stuff found in C / C+ her
|
||||
|
||||
https://stackoverflow.com/questions/1345670/stack-smashing-detected/51897264#51897264
|
||||
|
||||
link:userland/c/smash_stack.c[]
|
||||
Example:: link:userland/c/smash_stack.c[]
|
||||
|
||||
Leads to the dreadful "Stack smashing detected" message. Which is infinitely better than a silent break in any case.
|
||||
|
||||
==== Memory leaks
|
||||
|
||||
How to debug: https://stackoverflow.com/questions/6261201/how-to-find-memory-leak-in-a-c-code-project/57877190#57877190
|
||||
|
||||
Example: link:userland/c/memory_leak.c[]
|
||||
|
||||
=== Userland content bibliography
|
||||
|
||||
|
||||
Reference in New Issue
Block a user