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:
Michael Tuexen 2013-09-19 06:19:24 +00:00
parent d83d73618f
commit 10e6d832d5

View File

@ -101,10 +101,10 @@ sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt,
sctp_assoc_t * id)
{
char *buf;
int i, ret, cnt, *aa;
int i, ret, *aa;
char *cpto;
const struct sockaddr *at;
size_t len = sizeof(int);
size_t len;
/* validate the address count and list */
if ((addrs == NULL) || (addrcnt <= 0)) {
@ -115,8 +115,8 @@ sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt,
errno = E2BIG;
return (-1);
}
len = sizeof(int);
at = addrs;
cnt = 0;
cpto = buf + sizeof(int);
/* validate all the addresses and get the size */
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)) {
*id = *(sctp_assoc_t *) buf;
}
free(buf);
return (ret);
}