mirror of
https://github.com/github/codeql.git
synced 2026-01-17 08:24:46 +01:00
20 lines
647 B
Plaintext
20 lines
647 B
Plaintext
/**
|
|
* @name Memory is never freed
|
|
* @description A function always returns before freeing memory that was allocated in the function. Freeing all memory allocated in the function before returning ties the lifetime of the memory blocks to that of the function call, making it easier to avoid and detect memory leaks.
|
|
* @kind problem
|
|
* @id cpp/memory-never-freed
|
|
* @problem.severity warning
|
|
* @security-severity 7.5
|
|
* @tags efficiency
|
|
* security
|
|
* external/cwe/cwe-401
|
|
*/
|
|
|
|
import MemoryFreed
|
|
|
|
from AllocationExpr alloc
|
|
where
|
|
alloc.requiresDealloc() and
|
|
not allocMayBeFreed(alloc)
|
|
select alloc, "This memory is never freed."
|