diff --git a/stdlib/FileWatching/src/FileWatching.jl b/stdlib/FileWatching/src/FileWatching.jl index 1945fbd29e9b7..8512cae6b9e2b 100644 --- a/stdlib/FileWatching/src/FileWatching.jl +++ b/stdlib/FileWatching/src/FileWatching.jl @@ -191,11 +191,11 @@ mutable struct _FDWatcher associate_julia_struct(handle, this) err = ccall(:uv_poll_init_socket, Int32, (Ptr{Void}, Ptr{Void}, Ptr{Void}), eventloop(), handle, fd.handle) - finalizer(uvfinalize, this) if err != 0 Libc.free(handle) throw(UVError("FDWatcher", err)) end + finalizer(uvfinalize, this) return this end end