Fix Coverity Scan CID 60372 (Handle variable sd going out of scope leaks the handle.)

This commit is contained in:
Dong Anyuan
2019-06-20 12:35:04 +09:00
parent 65d168143f
commit 1d017a3625
+4
View File
@@ -764,6 +764,10 @@ static int sctp_create_new_listener(
if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENTS, &event,
sizeof(struct sctp_event_subscribe)) < 0) {
SCTP_ERROR("setsockopt: %s:%d\n", strerror(errno), errno);
if (sd != -1) {
close(sd);
sd = -1;
}
free(addr);
return -1;
}