From owner-svn-src-head@FreeBSD.ORG Thu Sep 19 06:19:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 88BD67E6; Thu, 19 Sep 2013 06:19:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 771232531; Thu, 19 Sep 2013 06:19:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8J6JPI9051549; Thu, 19 Sep 2013 06:19:25 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8J6JPa5051548; Thu, 19 Sep 2013 06:19:25 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201309190619.r8J6JPa5051548@svn.freebsd.org> From: Michael Tuexen Date: Thu, 19 Sep 2013 06:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255695 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Sep 2013 06:19:25 -0000 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); }