Project

General

Profile

Actions

Feature #2735

open

104: All allocated memory should be freed on module uploading

Added by Evgeny Novikov over 12 years ago. Updated about 10 years ago.

Status:
Open
Priority:
Normal
Start date:
04/10/2012
Due date:
% Done:

0%

Estimated time:
Published in build:

Description

  1. At the end all allocated memory should be free.
  2. It’s not allowed to free the same memory twice.
  3. 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 the null pointer.

Links
Sample bugfix

Note
This is a generic:resource:leaks class of our classifier.


Files

104_1a.patch (600 Bytes) 104_1a.patch Patch to linux-stable kernel to find exactly the same bug as fixed in commit c0cc359 Evgeny Novikov, 04/24/2012 02:00 PM
Actions

Also available in: Atom PDF