Project

General

Profile

Feature #2735

Updated by Vadim Mutilin over 9 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. leak 
 *    Freeing an allocated memory only once. once 
 *    Freeing only allocated memory. memory 

 Memory allocation functions are _kmalloc_ and _kzalloc_, a free function is _kfree_. It is correct to free the null pointer. 

 *Links* 
 "Sample bugfix":https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=c0cc35919317b579b23514c1385f246f348852ad 

 *Note* 
 This is a _generic:resource:leaks_ class of our classifier.

Back