Message ID | 20220815171947.57e919df@gandalf.local.home (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | trace-cmd: Close socket descriptor on failed connection | expand |
diff --git a/tracecmd/trace-vsock.c b/tracecmd/trace-vsock.c index 3bad9efad39a..baa310f7586b 100644 --- a/tracecmd/trace-vsock.c +++ b/tracecmd/trace-vsock.c @@ -19,8 +19,10 @@ int __hidden trace_vsock_open(unsigned int cid, unsigned int port) if (sd < 0) return -errno; - if (connect(sd, (struct sockaddr *)&addr, sizeof(addr))) + if (connect(sd, (struct sockaddr *)&addr, sizeof(addr))) { + close(sd); return -errno; + } return sd; }