From owner-svn-src-head@freebsd.org Sat Dec 23 16:23:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E37F3E85200; Sat, 23 Dec 2017 16:23:59 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB8856908B; Sat, 23 Dec 2017 16:23:59 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBNGNw0B055226; Sat, 23 Dec 2017 16:23:58 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBNGNwgr055225; Sat, 23 Dec 2017 16:23:58 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201712231623.vBNGNwgr055225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Sat, 23 Dec 2017 16:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327108 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kan X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 327108 X-SVN-Commit-Repository: base 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.25 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: Sat, 23 Dec 2017 16:24:00 -0000 Author: kan Date: Sat Dec 23 16:23:58 2017 New Revision: 327108 URL: https://svnweb.freebsd.org/changeset/base/327108 Log: Do not double free the memory in if_clone. if_clone_attach function will drop the reference on failure which will free the if_clone structure. No need to do it second time. Reviewed by: glebius, ae Differential Revision: https://reviews.freebsd.org/D10386 Modified: head/sys/net/if_clone.c Modified: head/sys/net/if_clone.c ============================================================================== --- head/sys/net/if_clone.c Sat Dec 23 14:30:44 2017 (r327107) +++ head/sys/net/if_clone.c Sat Dec 23 16:23:58 2017 (r327108) @@ -387,10 +387,8 @@ if_clone_advanced(const char *name, u_int maxunit, ifc ifc->ifc_create = create; ifc->ifc_destroy = destroy; - if (if_clone_attach(ifc) != 0) { - if_clone_free(ifc); + if (if_clone_attach(ifc) != 0) return (NULL); - } EVENTHANDLER_INVOKE(if_clone_event, ifc); @@ -410,10 +408,8 @@ if_clone_simple(const char *name, ifcs_create_t create ifc->ifcs_destroy = destroy; ifc->ifcs_minifs = minifs; - if (if_clone_attach(ifc) != 0) { - if_clone_free(ifc); + if (if_clone_attach(ifc) != 0) return (NULL); - } for (unit = 0; unit < minifs; unit++) { char name[IFNAMSIZ];