Skip to content

Commit

Permalink
Set SV-COMP global flag for invalid-memcleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mrstanb committed Oct 2, 2023
1 parent 1384f73 commit 4e70422
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/analyses/memLeak.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct
let warn_for_multi_threaded ctx =
if not (ctx.ask (Queries.MustBeSingleThreaded { since_start = true })) then (
set_mem_safety_flag InvalidMemTrack;
set_mem_safety_flag InvalidMemcleanup;
M.warn ~category:(Behavior (Undefined MemoryLeak)) ~tags:[CWE 401] "Program isn't running in single-threaded mode. A memory leak might occur due to multi-threading"
)

Expand All @@ -31,9 +32,11 @@ struct
match assert_exp_imprecise, exp with
| true, Some exp ->
set_mem_safety_flag InvalidMemTrack;
set_mem_safety_flag InvalidMemcleanup;
M.warn ~category:(Behavior (Undefined MemoryLeak)) ~tags:[CWE 401] "assert expression %a is unknown. Memory leak might possibly occur for heap variables: %a" d_exp exp D.pretty state
| _ ->
set_mem_safety_flag InvalidMemTrack;
set_mem_safety_flag InvalidMemcleanup;
M.warn ~category:(Behavior (Undefined MemoryLeak)) ~tags:[CWE 401] "Memory leak detected for heap variables: %a" D.pretty state

(* TRANSFER FUNCTIONS *)
Expand Down

0 comments on commit 4e70422

Please sign in to comment.