Fix Coverity Scan CID 60351 (Variable sctp_cnx going out of scope leaks the storage it points to.)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user