svn commit: r255695 - head/lib/libc/net

Michael Tuexen tuexen at FreeBSD.org
Thu Sep 19 06:19:25 UTC 2013


Author: tuexen
Date: Thu Sep 19 06:19:24 2013
New Revision: 255695
URL: http://svnweb.freebsd.org/changeset/base/255695

Log:
  Remove an unused variable and fix a memory leak in sctp_connectx().
  
  Approved by:	re (gjb)
  MFC after:	3 days

Modified:
  head/lib/libc/net/sctp_sys_calls.c

Modified: head/lib/libc/net/sctp_sys_calls.c
==============================================================================
--- head/lib/libc/net/sctp_sys_calls.c	Thu Sep 19 05:43:23 2013	(r255694)
+++ head/lib/libc/net/sctp_sys_calls.c	Thu Sep 19 06:19:24 2013	(r255695)
@@ -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-all mailing list