diff --git a/infer/src/backend/ClosuresSubstitution.ml b/infer/src/backend/ClosuresSubstitution.ml index 93da6e18a..f37da21c4 100644 --- a/infer/src/backend/ClosuresSubstitution.ml +++ b/infer/src/backend/ClosuresSubstitution.ml @@ -100,7 +100,7 @@ let replace_instr node (astate : Domain.t) (instr : Sil.instr) : Sil.instr = let captured_values = List.map ~f:(fun (id_exp, _, typ, _) -> (id_exp, typ)) c.captured_vars in - let actual_params = actual_params @ captured_values in + let actual_params = captured_values @ actual_params in let new_instr = Sil.Call (ret_id_typ, Const (Cfun c.name), actual_params, loc, call_flags) in diff --git a/infer/tests/codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m b/infer/tests/codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m index 1bd6025bc..036b4a32c 100644 --- a/infer/tests/codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m +++ b/infer/tests/codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m @@ -17,13 +17,13 @@ int block_captured_var_leak_bad() { return blk(); } -int block_free_ok() { +int block_free_ok(int* y) { int* x = malloc(sizeof(int)); *x = 2; - int (^blk)(void) = ^() { - int i = *x; + int (^blk)(int*) = ^(int* y) { + int i = *x + *y; free(x); return i; }; - return blk(); + return blk(y); }