Skip to content

Commit

Permalink
safer
Browse files Browse the repository at this point in the history
  • Loading branch information
ranocha committed Jul 27, 2024
1 parent a6f93fe commit 1aae311
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/solvers/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1953,17 +1953,21 @@ for TI in IndexTypes
X_Handle = Ptr{cholmod_dense_struct}(pointer_from_objref(dense_x))
Y_Handle = Ptr{cholmod_dense_struct}(C_NULL)
E_Handle = Ptr{cholmod_dense_struct}(C_NULL)
GC.@preserve dense_x dense_b begin
status = $(cholname(:solve2, TI))(
status = GC.@preserve x dense_x b dense_b begin
$(cholname(:solve2, TI))(
CHOLMOD_A, L,
Ref(dense_b), C_NULL,
Ref(X_Handle), C_NULL,
Ref(Y_Handle),
Ref(E_Handle),
getcommon($TI))
end
free!(Y_Handle)
free!(E_Handle)
if Y_Handle != C_NULL
free!(Y_Handle)
end
if E_Handle != C_NULL
free!(E_Handle)
end
@assert !iszero(status)

return x
Expand Down

0 comments on commit 1aae311

Please sign in to comment.