File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,13 @@ public func resolveSymlinks(_ path: AbsolutePath) -> AbsolutePath {
28
28
// that implements readlink and not realpath.
29
29
if let resultPtr = TSCLibc . realpath ( pathStr, nil ) {
30
30
let result = String ( cString: resultPtr)
31
+ // If `resolved_path` is specified as NULL, then `realpath` uses
32
+ // malloc(3) to allocate a buffer [...]. The caller should deallocate
33
+ // this buffer using free(3).
34
+ //
35
+ // String.init(cString:) creates a new string by copying the
36
+ // null-terminated UTF-8 data referenced by the given pointer.
37
+ resultPtr. deallocate ( )
31
38
// FIXME: We should measure if it's really more efficient to compare the strings first.
32
39
return result == pathStr ? path : AbsolutePath ( result)
33
40
}
You can’t perform that action at this time.
0 commit comments