From owner-svn-src-all@FreeBSD.ORG Wed Jul 18 08:58:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F07A106564A; Wed, 18 Jul 2012 08:58:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B1BD8FC0A; Wed, 18 Jul 2012 08:58:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I8wUex048162; Wed, 18 Jul 2012 08:58:30 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I8wUYB048160; Wed, 18 Jul 2012 08:58:30 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207180858.q6I8wUYB048160@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 18 Jul 2012 08:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238573 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 08:58:31 -0000 Author: glebius Date: Wed Jul 18 08:58:30 2012 New Revision: 238573 URL: http://svn.freebsd.org/changeset/base/238573 Log: Plug a reference leak: before doing 'goto again' we need to unref ia->ia_ifa if there is any. Submitted by: Andrey Zonov Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Jul 18 08:41:00 2012 (r238572) +++ head/sys/netinet/ip_output.c Wed Jul 18 08:58:30 2012 (r238573) @@ -124,7 +124,7 @@ ip_output(struct mbuf *m, struct mbuf *o int n; /* scratchpad */ int error = 0; struct sockaddr_in *dst; - struct in_ifaddr *ia = NULL; + struct in_ifaddr *ia; int isbroadcast, sw_csum; struct route iproute; struct rtentry *rte; /* cache for ro->ro_rt */ @@ -198,6 +198,7 @@ ip_output(struct mbuf *m, struct mbuf *o dst = (struct sockaddr_in *)&ro->ro_dst; again: + ia = NULL; /* * If there is a cached route, * check that it is to the same destination @@ -533,8 +534,11 @@ sendit: #endif error = netisr_queue(NETISR_IP, m); goto done; - } else + } else { + if (ia != NULL) + ifa_free(&ia->ia_ifa); goto again; /* Redo the routing table lookup. */ + } } #ifdef IPFIREWALL_FORWARD @@ -564,6 +568,8 @@ sendit: bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in)); m->m_flags |= M_SKIP_FIREWALL; m_tag_delete(m, fwd_tag); + if (ia != NULL) + ifa_free(&ia->ia_ifa); goto again; } #endif /* IPFIREWALL_FORWARD */