Skip to content

Commit

Permalink
Fix LocationInfo memory issue
Browse files Browse the repository at this point in the history
  • Loading branch information
peremato committed May 31, 2024
1 parent e03b9fe commit 1a6c763
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/FileSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ function locate(fs::FileSystem, path::String, flags::XRootD.XrdCl!OpenFlags!Flag
locations_p = Ref(CxxPtr{LocationInfo}(C_NULL))
st = XRootD.Locate(fs, path, flags, locations_p, timeout)
if isOK(st)
#locations = LocationInfo(locations_p[][]) # copy constructor
locations = [At(locations_p[], i)[] for i in 0:GetSize(locations_p[])-1]
#locations = LocationInfo(locations_p[][]) # copy constructor does not exists :-(
locations = Location[]
for i in 0:GetSize(locations_p[])-1
loc = At(locations_p[], i)
push!(locations, Location(loc |> GetAddress, loc |> GetType, loc |> GetAccessType))
end
XRootD.delete(locations_p[]) # delete the pointer
return st, locations
else
Expand Down

0 comments on commit 1a6c763

Please sign in to comment.