Commit 21e62a39 authored by Dong Anyuan's avatar Dong Anyuan

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

parent 122bca70
...@@ -800,11 +800,15 @@ static int sctp_create_new_listener( ...@@ -800,11 +800,15 @@ static int sctp_create_new_listener(
if (sctp_bindx(sd, addr, used_addresses, SCTP_BINDX_ADD_ADDR) != 0) { if (sctp_bindx(sd, addr, used_addresses, SCTP_BINDX_ADD_ADDR) != 0) {
SCTP_ERROR("sctp_bindx: %s:%d\n", strerror(errno), errno); SCTP_ERROR("sctp_bindx: %s:%d\n", strerror(errno), errno);
free(sctp_cnx);
sctp_cnx = NULL;
return -1; return -1;
} }
if (listen(sd, 5) < 0) { if (listen(sd, 5) < 0) {
SCTP_ERROR("listen: %s:%d\n", strerror(errno), errno); SCTP_ERROR("listen: %s:%d\n", strerror(errno), errno);
free(sctp_cnx);
sctp_cnx = NULL;
return -1; return -1;
} }
...@@ -823,6 +827,11 @@ err: ...@@ -823,6 +827,11 @@ err:
sd = -1; sd = -1;
} }
if (sctp_cnx != NULL) {
free(sctp_cnx);
sctp_cnx = NULL;
}
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment