Feature #2735
Updated by Pavel Andrianov about 10 years ago
This is a _generic:resource:leaks_ class of our classifier. I'm going to implement the model (104_1a) for some trivial cases just to find a bug.
At the end all allocated memory should be free. It’s not allowed to free the same memory twice. It’s not allowed to free not allocated memory.
*Description*
The dynamic allocation is widely used in Linux. The incorrect usage of heap may lead to memory leaks or even to failures, when the module tries to free not allocated memory. So, the correct usage of heap includes
* Freeing all allocated memory to avoid a memory leak
* Freeing an allocated memory only once
* Freeing only allocated memory
Memory allocation functions are _kmalloc_ and _kzalloc_, a free function is _kfree_. It is correct to free null pointer.
*Links*
"Sample bugfix":https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=c0cc35919317b579b23514c1385f246f348852ad