Fix Coverity Scan CID 60351 (Variable sctp_cnx going out of scope leaks the storage it points to.)

This commit is contained in:
Dong Anyuan
2019-06-20 12:37:08 +09:00
parent 1338654285
commit 264e429f23
+9
View File
@@ -800,11 +800,15 @@ static int sctp_create_new_listener(
if (sctp_bindx(sd, addr, used_addresses, SCTP_BINDX_ADD_ADDR) != 0) {
SCTP_ERROR("sctp_bindx: %s:%d\n", strerror(errno), errno);
free(sctp_cnx);
sctp_cnx = NULL;
return -1;
}
if (listen(sd, 5) < 0) {
SCTP_ERROR("listen: %s:%d\n", strerror(errno), errno);
free(sctp_cnx);
sctp_cnx = NULL;
return -1;
}
@@ -823,6 +827,11 @@ err:
sd = -1;
}
if (sctp_cnx != NULL) {
free(sctp_cnx);
sctp_cnx = NULL;
}
return -1;
}