mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-15 01:53:41 +08:00
If memory context is switched temporarily and there is no switch back, it will cause strange errors. This adds a Coccinelle rule that checks for a case where the memory context is saved in a temporary variable but this variable is not used to switch back to the original memory context. Co-authored-by: Fabrízio de Royes Mello <fabrizio@timescale.com>
This directory contains scripts to check the codebase for defective programming patterns, eg use after free or not freeing resources.
Coccinelle is a static code analysis program. It uses a semantic patch language which resembles unified diff output. The semantic patches may inline python or ocaml code for more advanced use cases.
A coccinelle patch file consists of multiple blocks. Example block header:
@ name @
Expression var1;
Expression var2;
@@
The block header may contain variable definitions. It may also contain required matches or non-matches in previous blocks. Examples for blocks with required previous matches:
@ b2 depends on name @
@@
@ b3 depends on name && !b2 @
@@
Variables inside a block can also reference matches from previous blocks.
@ b2 depends on name @
Expression name.var1;
@@
var1 inside this block will be the match from the name
block.