From owner-svn-src-head@FreeBSD.ORG Sat Apr 5 20:44:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7FE05BFF; Sat, 5 Apr 2014 20:44:53 +0000 (UTC) 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D8C3C09; Sat, 5 Apr 2014 20:44:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s35KirID078507; Sat, 5 Apr 2014 20:44:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s35KirsT078506; Sat, 5 Apr 2014 20:44:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201404052044.s35KirsT078506@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 5 Apr 2014 20:44:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264173 - head/sys/kern 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.17 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, 05 Apr 2014 20:44:53 -0000 Author: kib Date: Sat Apr 5 20:44:52 2014 New Revision: 264173 URL: http://svnweb.freebsd.org/changeset/base/264173 Log: Use realloc(9) instead of doing the reallocation inline. Submitted by: bde MFC after: 1 week Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sat Apr 5 20:26:17 2014 (r264172) +++ head/sys/kern/kern_linker.c Sat Apr 5 20:44:52 2014 (r264173) @@ -725,14 +725,8 @@ linker_file_add_dependency(linker_file_t linker_file_t *newdeps; sx_assert(&kld_sx, SA_XLOCKED); - newdeps = malloc((file->ndeps + 1) * sizeof(*newdeps), M_LINKER, - M_WAITOK | M_ZERO); - - if (file->deps) { - bcopy(file->deps, newdeps, file->ndeps * sizeof(*newdeps)); - free(file->deps, M_LINKER); - } - file->deps = newdeps; + file->deps = realloc(file->deps, (file->ndeps + 1) * sizeof(*newdeps), + M_LINKER, M_WAITOK | M_ZERO); file->deps[file->ndeps] = dep; file->ndeps++; KLD_DPF(FILE, ("linker_file_add_dependency:"