mirror of
https://github.com/containers/skopeo.git
synced 2025-08-01 14:58:11 +00:00
proxy: Move defer() higher up
Pre-existing problem noticed in review. Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
parent
983e77d85f
commit
6ecc6c334f
@ -897,6 +897,15 @@ func (h *proxyHandler) close() {
|
||||
// send writes a reply buffer to the socket
|
||||
func (buf replyBuf) send(conn *net.UnixConn, err error) error {
|
||||
logrus.Debugf("Sending reply: err=%v value=%v pipeid=%v datafd=%v errfd=%v", err, buf.value, buf.pipeid, buf.fd, buf.errfd)
|
||||
// We took ownership of these FDs, so close when we're done sending them or on error
|
||||
defer func() {
|
||||
if buf.fd != nil {
|
||||
buf.fd.Close()
|
||||
}
|
||||
if buf.errfd != nil {
|
||||
buf.errfd.Close()
|
||||
}
|
||||
}()
|
||||
replyToSerialize := reply{
|
||||
Success: err == nil,
|
||||
Value: buf.value,
|
||||
@ -910,15 +919,6 @@ func (buf replyBuf) send(conn *net.UnixConn, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// We took ownership of these FDs, so close when we're done sending them or on error
|
||||
defer func() {
|
||||
if buf.fd != nil {
|
||||
buf.fd.Close()
|
||||
}
|
||||
if buf.errfd != nil {
|
||||
buf.errfd.Close()
|
||||
}
|
||||
}()
|
||||
// Copy the FD number(s) to the socket ancillary buffer
|
||||
fds := make([]int, 0)
|
||||
if buf.fd != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user