svn commit: r265965 - stable/9/lib/libc/net

Michael Tuexen tuexen at FreeBSD.org
Tue May 13 17:41:40 UTC 2014


Author: tuexen
Date: Tue May 13 17:41:39 2014
New Revision: 265965
URL: http://svnweb.freebsd.org/changeset/base/265965

Log:
  MFC r255695:
  
  Remove an unused variable and fix a memory leak in sctp_connectx().

Modified:
  stable/9/lib/libc/net/sctp_sys_calls.c
Directory Properties:
  stable/9/lib/   (props changed)
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/net/sctp_sys_calls.c
==============================================================================
--- stable/9/lib/libc/net/sctp_sys_calls.c	Tue May 13 17:25:39 2014	(r265964)
+++ stable/9/lib/libc/net/sctp_sys_calls.c	Tue May 13 17:41:39 2014	(r265965)
@@ -101,10 +101,10 @@ sctp_connectx(int sd, const struct socka
     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 socka
 		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 socka
 	if ((ret == 0) && (id != NULL)) {
 		*id = *(sctp_assoc_t *) buf;
 	}
+	free(buf);
 	return (ret);
 }
 


More information about the svn-src-stable-9 mailing list