Skip to content

Commit

Permalink
Fix AllocVar onstack=true for AllocA
Browse files Browse the repository at this point in the history
  • Loading branch information
karoliineh committed Jan 29, 2024
1 parent 2c580b1 commit 4303313
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/analyses/mallocFresh.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ struct

let special ctx lval f args =
let desc = LibraryFunctions.find f in
let alloc_var on_stack =
match ctx.ask (AllocVar {on_stack = on_stack}) with
| `Lifted var -> D.add var ctx.local
| _ -> ctx.local
in
match desc.special args with
| Malloc _
| Calloc _
| Realloc _
| Alloca _ ->
begin match ctx.ask (AllocVar {on_stack = false}) with
| `Lifted var -> D.add var ctx.local
| _ -> ctx.local
end
| Realloc _ -> alloc_var false
| Alloca _ -> alloc_var true
| _ ->
match lval with
| None -> ctx.local
Expand Down

0 comments on commit 4303313

Please sign in to comment.