Remove an unused variable and fix a memory leak in sctp_connectx().
Approved by: re (gjb) MFC after: 3 days
This commit is contained in:
parent
d83d73618f
commit
10e6d832d5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255695
@ -101,10 +101,10 @@ sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt,
|
|||||||
sctp_assoc_t * id)
|
sctp_assoc_t * id)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
int i, ret, cnt, *aa;
|
int i, ret, *aa;
|
||||||
char *cpto;
|
char *cpto;
|
||||||
const struct sockaddr *at;
|
const struct sockaddr *at;
|
||||||
size_t len = sizeof(int);
|
size_t len;
|
||||||
|
|
||||||
/* validate the address count and list */
|
/* validate the address count and list */
|
||||||
if ((addrs == NULL) || (addrcnt <= 0)) {
|
if ((addrs == NULL) || (addrcnt <= 0)) {
|
||||||
@ -115,8 +115,8 @@ sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt,
|
|||||||
errno = E2BIG;
|
errno = E2BIG;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
len = sizeof(int);
|
||||||
at = addrs;
|
at = addrs;
|
||||||
cnt = 0;
|
|
||||||
cpto = buf + sizeof(int);
|
cpto = buf + sizeof(int);
|
||||||
/* validate all the addresses and get the size */
|
/* validate all the addresses and get the size */
|
||||||
for (i = 0; i < addrcnt; i++) {
|
for (i = 0; i < addrcnt; i++) {
|
||||||
@ -161,6 +161,7 @@ sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt,
|
|||||||
if ((ret == 0) && (id != NULL)) {
|
if ((ret == 0) && (id != NULL)) {
|
||||||
*id = *(sctp_assoc_t *) buf;
|
*id = *(sctp_assoc_t *) buf;
|
||||||
}
|
}
|
||||||
|
free(buf);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user