mirror of
https://github.com/github/codeql.git
synced 2025-12-28 14:46:33 +01:00
19 lines
620 B
Plaintext
19 lines
620 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
|
|
* @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"
|