0d83fe6 os: close fd if fd.Stat fails in Getwd

Authored and Committed by Tobias Klauser 3 years ago
    os: close fd if fd.Stat fails in Getwd
    
    Avoid leaking fd in case fd.Stat() fails in the fall back implementation
    of Getwd.
    
    Change-Id: I8656d42e8dbc8893b7159873f173d6bf0d4febe6
    Reviewed-on: https://go-review.googlesource.com/c/go/+/256221
    Trust: Tobias Klauser <tobias.klauser@gmail.com>
    Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Go Bot <gobot@golang.org>
    
        
file modified
+1 -1